#@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@W!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr d M * @  $ % CC$$)%1 Udߥ$9%: !0 S$%} DD˙`  }J)Lr J  ((  p L ()   J}L= ( L 0q A    IB JC;? D W } LL  ` W )LA!  ߰")-݆ p" } $G@LL 08`Q")<2Q0 -G$Ș݆ UL# ; p8(()(0ʥ)NQ` }$GȘ݆LU )L ݆ L GȘ ݆LL )W>Z   HH)H }p h  hyhy D L> L JJ    ! LA*` BF }7'8  M HN H` 8 Z  \LdJJ!"! GFE@F (!L }EE !E^ ^ E E7EȩEdE/EȩE  D } .L }  ;F d  ;?F7F? ( .   Z D LL d } . D  L    p  E` , d)  D L) 0BM݊L݉} ML  N݆ L NLML [ TEqEHȱEqEh 0Gȹ G} HLL GɛL  LFREE SECTORS G) *Gȩ GȽG GȌ*jj >G} C8jJ3j2CD( C202C ԠBX` N 1? l LlD:RAMDISK}.COMLu L1 L ;LHL  T`  `1  ɐ     `TU  } L ? .  t`GBJ ~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI4 0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D1:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D1:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J  (` 9 V⪍ ઍ  -'}LLu ÝDEHILV 9 .l 9 .l  `` s$B BH(}I|DE V BLV nB,DE JLV B V BLVDEIʩ BꭝLu j} 3E:}DISK OPERATING SYSTEM II VERSION COPYRIGHT 1984 ATARI CORP.A. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDG*}E J. DUPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRES+}SF. LOCK FILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES P. FORMAT SINGLEL !N',}#"&))9(&*)/h)''-&؆莟R'S  vL/ˢ L }Insert DOS 2.0s, type Y Λx -}DEfHI 1莏#q! @ y0ɛ8A0,' ȅ 1 1ild! 1L!NO SUCH ITEMSELECT.} ITEM OR FOR MENU! 0 .z:*{}.|{ 1 0 0JB 18L%|DL/}%DIRECTORY--SEARCH SPEC,LIST FILE?[# 0 0 &|D3" 1L!NOT A DISK FILEN !B 1L!E# 1 !BD0}ED:}:1BJ|DE 1DEBHI 1 h0ߢ 0.1}  0?詛 1 y0YЛ 1 ;#L" ;#L! BL1TYPE "Y" TO DELETE...DELETE FILE SPEC2}COPY--FROM, TO?OPTION NOT ALLOWED 074 FREE SECTORS COPYING---D2:SHOWDOWN.GMSl# 0|D .L/%#3}##JB|DE 1BHID#E 1#0: B 1L!#͑### B 1#c$0SY4}S1}:## # # .#Ƚ# # 𩛙## 1,#PD#ELJ- <.BJD#E 5}1 1HH 0hh|DL%1}:̳# L% #D#EL% 1 0 . .0O% 1L!WILD CARDS NOT A6}LLOWED IN DESTINATION 0 <.|K}N 2 FORMAT. t* 5) 1L!`) 0NΞ 0 L1) 1 L!BAD LOAD FILELOAD FROM WHAT FILE?) 0 ?}0#B 1L!WHAT FILE TO LOCK?) 0 0$B 1L!WHAT FILE TO UNLOCK?DUP DISK-SOURCE,DEST DRIVES?TYPE "Y" IF OK TO US@}E PROGRAM AREACAUTION: A "Y" INVALIDATES MEM.SAV.FE! +L1   `*  70 2 2A} 0.* 1 y0 0)INSERT BOTH DISKS, TYPE RETURN^, 1 y038逍 N, 1L! ,B}C, t*  Lx+, 0 ^, 1 y0 , ,0,0 ,L+ ,I0 ,Vǭ0C}Ξ, 0 }, 1 y0C,ШC, 0K'!" H H 'h h Lx+!EF 5L1L!D,I,HhD}` NOT ENOUGH ROOMINSERT SOURCE DISK,TYPE RETURNINSERT DESTINATION DISK,TYPE RETURNE}`  `8 rL1`-* 1P* 1 y0Y`hhL!NAME OF FILE TO MOVE?- 0 0|DL% <.F},^ 1 70 0 .@L# .BJ 1  DEHIB V L1 ,} 1 70,L.  G}JB|,#P#DE 1 HI BDEHHII 1 B 1 ,^ 1 70,0La- B V,#PH},^ 1 70 0L#L!-* 1P* 1 y0Yj383}mm ݭI}}`8}``|* ? ɛ,`|:-)| / 1L!`DESTINATION CANT BE DOJ}S.SYS0 0H{ 24Δ 28/L!/) 2 Π 2 0 ξK}hAΞB,0 J 1 BDEHI,HÝDE 1HIHIDELSAVE-GIVE L}FILE,START,END(,INIT,RUN)O S0 1`BDEPHI V` S0H 1 L!M}0 0 1L~0`PLEASE TYPE 1 LETTER,0`hhL! 70 1L0L<1 ,;ɛ7,"ɛ:ݦ1ݥN}A"D|ݤD|ȩ:|ȩ|ɛ,,(/+.ީ1 1,ɛ`轤{NAMEO} TOO LONG B VL!` L1I H1EΝDL1|mDiE` V0`8d/8 i:222 1 LP}!ERROR- 162ɛ+,' 20*.. өr2 1``2TOO MANY DIGITSINVALID HEXAQ}DECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8uR} ECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8uM D D D D %BB! % 9* v% w%u % D %LJ& fffffff>`<T}|0`̌8l8pv00````00 0f< x||||W}|||~|l8l8lfff< 0`@`0 000006c!"|™X}|™|~x|™|as22sa>2222r|晒xLLLLNB|晁晉|™||™Y}v|~Þ~fdddd||晙d8晙™晙dd|2x`x`~<~~<"#30 ~ <~~<Z}|~~||~~||>````~~8<8<||[}~~~|0000~l8|ll8l~ 8`8pp##8\}$ %0$1$3$4$ ?̏?1$4$ॄ``ex$w$e{$z$褄 x${]}$`(mDeXYi????)^̜D)DȄ?Čei?̜D@L$^}i( %&L$??`??????8??Ƌ拑` T8` 8` n%D_} %LJ&} T8t?????@:@CD(DDi?18?8?8?@K????` -??`} $ &= Y%&'?L' &= Y%?`'XRUT`H)h)` i@LG&8 `DCIDID $ 8a}Х)LS&ЭC?H &hɛL&,C0ɜf) `{\\X^T_PHC^? e,h .&) Cb} $8??''i?i? 'LJ&?'?'LJ&ʊ &HIHd'Hc'H`# \^_|}~2k)c}9:+O)29+,0];'3A/1/s)l32'))(m(( ):--,+<,+4,++d,CIC`"I"` (8??8??? ??d} $8?内?凅((?m???i? $L'`8???? ????8?? ??`8??e}`??`ЭD(DDΝD $ '} T8L &L'ЭDΜDΜDD $ '} T8L &ƇƆL'f}Ƌ^^()`8eiL'^` 懥͒?^eiL'??L'g}??8̓??? $LC)s)s)`)))))`Ƌ ^`^Ƌ͂?L)ƌ h}L(L)??L')*^懥͒?LC)懥͒?LC)^L4)?????i}`8??hh``8Ie?Ie?????8?m?͉? &۠= Y%?`???m?j}??m?? $????8?傅*+?僅 $8??????` K* ( h*8????` n( K* ( h*L+k}L. 9*2 &= Y% o%H &h)_ @W K* (Lh*S K* )Lh*P K* ;-Lh*`8????ХL'??l}L+͒???L++,L+ee8?傅?僅8傍?働? $8??????`m} @LO, @ O,L4) @ {, @` @ @ {,L'?m @?m @ͅ?hhL,m @m @8?倅?偅n} M$?m @??m @?`?It?`= Y% 8)})Y`,-Э`2 & > Y% ,L & % %LJ&^懥͒?o}LC)L4)Ƌ^Ƌ̓?L)8ee8内包LM-L'@ԩ-0p}1-XYȑȑ`ppp-.A-Hs) ԍЍ)Х  h@Эq} 9* &> Y%I $I2 o%)_ @W . )L.S . )L.P . -L. 'L &??`8??r}?? *?? $L5.'U?? T8~ T8? o%?,C09 .n/CL.ɛE~L.~ T8L.) }̓?𻥌)s}Ю ? T8CL.?`2 &Ϡ= Y% ,L &D D D D Lto/j0CL|/C??L/Ct}8?勪,C0ɛ^L/ .&L/^L/ 2` &9> Y% [00@ w/p?D?E8??H??I B V0 ou}/ ';0 LX1H o/h!H} T8Q> Y%h v8 P0 -?` &Y> Y%L70C BLVpCCH@k0f1 .h? &hhL- P0Cv}D?E?HICJBLV8??ą &s> Y% [0L0 % 0L0LX1CDE8?冝Hw}?凝IB V`CHm??Im???e??e? /??` P0L0} T8ig1b2> Y%L70@ԭs)x})`????8* &?.??.??.??.? ??L1? ?8??????L1?`8????y}?? ? &> Y%?`m?m?8?倅?偅eͅ? &> Y%?` M$?m???c2^3m??z}?? $L'ȱȊ`)?! ;I@Ln(H)h)` @@L2i `Э& &? Y% .@L &?@̔?{}L &@@S@ .&ъ 拥͒?6@ei?Ō?卐8@@@ '` _3Z4& ? Y%|}?` &8???? v8?`KE:P@HH8@@@@1pHI B@ V( 0LJ&hh@`}} &נ>LY%L5ЭL= &> Y% o1 [0L5 o1 3?? @ @C3? @@3t@??[4V5@~}@?@L5^)@@@?挐?@?ȱ?8ei@ 5@ 58.@??䅎@ 7 5@}? 258??<:? ?? 25?E T8> Y% o% '; -} T8 &LJ&LX48?@0 5??兎B W5}R65 7 5 5 5@@?8@@@@ &> Y% o% 3??䅎A 5 7?@0 5` ?@ 3`?m@}@ 5` 3C 3` @) 25656 @L.7ʊ @6HHG6HF6H`8@eiLX4^@`wlrtbsnhf%p?xmqi6666}66S6N766766x6n6e6'7P7ȩ@L*6 1@L*6 1@?@L*6 1@?@L*6 1?L*6?L*6 1?L*6 1?L*6 1?L}*6 1?L*6 1?L*6@ȘH 25h@` 7?A?L*6ȱ^` 7?B?L*6 7L*6ȱ @Ls4 1H @)}hd@ *6LO7-86^ 2???`CC 0L3 % 0L3hhpCLN4̏?0 2 3 @  3_ 3L}7`@) @ 2c8@?J8? 3@L7e8??8? L7u @I @#@@@ q8@L7 @d@ 3L7.8)9 B V}nD8EHIBLV䌡8HI B V䬡8`E:Lx8Dԅ ؠH),D0 T8L8 3h0``}D 8D)?<D)@`I@`D9,P a{)ɀ`H2ҢҠh`lj;k+*opui-=vc*99bx}z436521, .nm/reytwq907~8<>fhdgsaLJ:K\^OPUI_|VCBXZ$#&%"![ ]NM?REYTWQ()'@}FHDGSA {  } ` }9: 2@ : 2@ &: $L9L &Э# &? Y% .:@?<@̔?}L &8@@e@@ee8?傅?僅 $8?@???:@) @ @ {,<@ .&:@m:@i}L':; ';pD>EHIJB V0\DDdDeDDD L;0?+K T8 L;03D L;0) T8DD. T8L: } L;ƌL:p B VpC`H T8h T8 L;0 T8LA;pHIBLV o1 .8 o1R} T8 : =DDDΘDΘD = o%};a;<)_ݼ;L<ʊ ;H;H`+*-=RLUF12345678 ;<<0<<<<<=========G=%= =DL< =DD} DDDL; =D8L< =Di͘DުL<>C) 2 C C.ʎDC`pBDHID}CELV CL^;pCJ C< w<0% % 00} T8 - &LJ&T T8LT8@ '; Y=Q> Y%@ v8 T8}> Y% o% =L< I==` Y=? Y%>LT8=>`Page 6 Writer by Phil CardwellExit to DOSBuffer FullDelete (S,W,P):} Are You Sure? (Y/N)ERASE ALL TEXTErase (S,W,P): to exitSave (Device:Filename)>Error #BREAK Key AbortNo ErrorsL}oad (Device:Filename)> Press D1:*.*Memory Ful>?lNo text in bufferPrint (Device:Filename)>Printing...Insert nex}t sheet, press Find:Not FoundChange To: -Exit ̭oad ̭elete ormat nlock ock ename Drive #}Rename to:Format Diskrive #w008063CHAPTER 13. THE SERIAL INPUT/OUTPUT INTERFACE (SIO)Most input and output with the Atari computer passes thr }ough the serial I/O bus. The SIO interface is rather complicated but you are unlikely to need to use it directly. CIO usually } handles SIO for you. However, if you want to design your own I/O device and it's associated handler, you need to know how to } use the SIO. SIO transfers data at a rate of 19,200 baud on separate input and output lines. The data is sent one byte at a }time, LSB first, in an asynchronous format. There are also clock-in and clock-out lines. There is a signal on the clock-out l }ine but it is not used by any present devices. The clock-in line is available for synchronous transfer but is not used by the } OS. The signal on the clock-out line goes high at the leading edge of each bit and goes low in the middle of each bit.One b }yte of SIO data +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ | | | | | | | | | | | | | | | | clock }-------------+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +------ ---------+ +---+ +-------+ +-------- | 0 | } 1 | 0 | 1 1 | 0 0 | 1 data +-------+ +---+ +-------+ | } | start bit stop bitThe SIO interface is used much like the resident disk han }dler. In fact, it uses the same device control block as the resident disk handler. After the control block parameters are set }, a JSR is made to the SIO entry vector, SIOV, at $E459 (58457).Device control block (for SIO)DDEVIC [$0300 (768)] Ser }ial bus I.D. Set by handler or program.DUNIT [$0301 (769) Device number if more than one.DCOMND [$0302 (770)] Device comma }nd byte.DSTATS [$0303 (771)]Before the SIO call, this byte tells whether the operation is read, write or that there is no d }ata transfer associated with the command. After the call this byte will hold the status (error/no error code) of the operatio }n.DSTATS format before command 7 6 5 4 3 2 1 0 ----------------- |W|R| not used | ---- }-------------If both W and R are 0, there is no data transfer.DBUFLO [$0304 (772)]DBUFHI [$0305 (773)]Points to the data }buffer for either input or output.DTIMLO [$0306 (774)]Timeout value (response time limit) in 64/60ths of a second to be set } by handler or program.DBYTLO [$0308 (776)]DBYTHI [$0309 (777)]Number of bytes to be transferred, set by handler or progra }m. This parameter is not required if the DSTATS specifies no data transfer.DAUX1 [$030A (778)]DAUX2 [$030B (779)]These p }arameters are sent to the device as part of the command frame.USING THE SIO INTERFACEAll commands on the serial bus must o }riginate from the computer. The peripherals will present data on the bus only when commanded to do so.Any operation on the s }erial bus begins with a five byte command frame. While the command frame is being sent, the command line of the serial connec }tor is 0.Command frame format $xx DDEVIC $xx DCOMND $xx DAUX1 $xx DAUX2 } $xx checksumThe first four bytes of the command frame come from the device control block. the checksum is the sum of the }other four bytes with the carry added back after each addition. If both R and W of the DSTATS are 0, no data is sent to, or e }xpected from the peripheral, after a command frame is sent. However, the device is usually expected to send an ACK byte ($41) } after the command frame is sent. If the command frame is invalid, an NAK byte ($4E) should be sent. If the operation is outp }ut (W = 1) the computer will send a data frame after it receives the ACK of the command frame. It then expects an ACK after t }he data frame is sent. If the operation is an input (R = 1) the computer expects a data frame from the peripheral after the A }CK. With either input or output, a "complete" code ($43) should be sent to the computer when the operation is finished. The " }complete" code would follow the ACK of the data frame with an output operation. If the operation is not completed for some re }ason, the peripheral should send an error code ($45) instead of "complete".SIO data frame byte 1 $xx\ } > data bytes byte n $xx/ byte n+1 $xx checksumSIO commandsREAD $52WRITE $57STATUS $53P }UT $50FORMAT $21DOWNLOAD $20READADDR $54READ SPIN $51MOTOR ON $55VERIFY SECTOR $56Present SIO device I. }D.sDISK $31 - $34 (D1 - D4)PRINTER $40RS-232-C $50 - $53 (R1 - R4)THE SERIAL CONNECTORThe serial connectors o }n the computer and all peripherials are identical. Nearly all peripherials have two serial connectors. Either connector may b }e used for any connection. The serial bus is designed so that peripherials can be daisy-chained together. The following is a }diagram of the serial connector.The serial connector pin-out 1 1 2 4 6 8 0 2 } ----------- /o o o o o o\ /o o o o o o o\ ----------------- 1 3 5 }7 9 1 1 1 3 1 clock in (to computer) 2 clock out 3 data in 4 GND 5 data out 6 GND 7 co }mmand (active low) 8 cassette motor control 9 proceed (active low)10 +5V/ready11 audio in12 +12V (400/800)13 inte }rrupt (active low)Proceed goes to pin 40 (CA1) of the PIA. It is not used by present peripherials. Interrupt goes to pin 18 }(CB1) of the PIA. It is not used by present peripherials. Pin 10 doubles as a 50mA +5V peripharal power supply and a computer } ready signal.Useful database variables and OS equatesSIOV $E459 (58457): serial port handler entryDDEVIC $0300 } (768): device IDDUNIT $0301 (769): device numberDCOMND $0302 (770): command byteDSTATS $0303 (77 }1): status byteDBUFLO $0304 (772): data buffer pointerDBUFHI $0305 (773):DTIMLO $0306 (774): timout v }alueDBYTLO $0308 (776): number of bytes to transferDBYTHI $0309 (777):DAUX1 $030A (778): sent to dev }iceDAUX2 $030B (779): sent to devicees to transferDBYTHI $0309 (777):DAUX1 $030A (778): sent to dev -008063CHAPTER 14. THE HARDWARE CHIPSThe previous chapters described the operating system of the computer. The fol}lowing chapters will examine the hardware which supports the 6502 and the hardware's associated software.THE GTIA CHIPThe }GTIA (George's Television Interface Adapter) is the main video circuit in the computer. It controls the following functions.}GTIA functionsPriority of overlapping objectsColor and brightness, including information from the antic chip.Player/missil}e control.console switches and game control triggers.THE ANTIC CHIPThe main job of the ANTIC chip is interpreting the dis}play buffer for the GTIA chip. The ANTIC chip is somewhat of a processor in it's own right. The program which runs it is call}ed the display list and usually resides just before the display buffer in memory. The ANTIC chip operates independent of the }6502. It operates by direct memory access (DMA). The ANTIC chip gives a HALT signal the 6502, causing the 6502 to give up con}trol of the address bus. The ANTIC chip can then read any data it needs to from memory.ANTIC chip functionsDMA (Direct Memo}ry Access) control.NMI (Non-Maskable Interrupt) control.LIGHT PEN READINGWSYNC (wait for horizontal sync)THE POKEY CHIP}The most important jobs of the POKEY chip are reading the keyboard and operating the serial port. It also has the following }functions. POKEY chip functions:- Keyboard reading: Serial port: Pot (game paddles) reading: Sound generation: System timers:} IRQ (maskable interrupt) control: Random number generator.THE PIA CHIPThe PIA (Parallel Interface Adapter) is a commonly }used I/O chip. It consists of two 8 bit parallel ports with hand shaking lines. In the Atari, it has the following functions.} Game controller port control (bi-directional). Peripheral control and interrupt lines. Registers in the hardware chips are t}reated as memory addresses. Many of the registers are write only. These registers cannot be read from after they are written }to. Other registers control one function when written to and give the status of an entirely different function when read from}. Still other registers are strobes. Any command which causes the address of one of these registers to appear on the address }bus will cause their functions to be performed. The write only registers have shadow registers in RAM. Data to be put in the }registers is usually put into the shadow registers. The data in the shadow registers is automatically moved to the operating }registers during vertical blank. For register use and address, see the previous chapters on the associated functions.erating u008063CHAPTER 15. DISPLAY LISTSThe program which runs the ANTIC chip is called the display list. Much like a micr}oprocessor, the ANTIC chip has a program counter, called the display list counter. The display list counter is a 16 bit regis}ter. However, the six most significant bits are semi-fixed. These bits can only be changed with a jump instruction. The resul}t of this is that the display list counter cannot cross a 1K memory boundary (i.e. $A3FF to $A400) without using a jump instr}uction. The ANTIC chip finds the address of the display list in DLISTL [$D402 (54274)] and DLISTH [$D403 (54275)]. SDLSTL [$0}230 (560)] and SDLSTH [$0231 (561)] are the shadow registers for DLISTL and DLISTH. The ANTIC chip also has a memory scan cou}nter. This register scans the display buffer for data to be interpreted and displayed. Once loaded, the memory scan counter's} 4 most significant bits are fixed. The result is that the memory scan counter cannot cross a 4K memory boundary (i.e. $AFFF }to $B000) without being reloaded.DISPLAY LIST INSTRUCTIONSThere are three basic instructions in the display list. The type} of instruction is determined by bits 0,1,2 and 3 of an instruction byte. The other four bits give auxilliary parameters for }the instruction. Bit 7 always enables a display list interrupts (DLIs). Display list instruction format 7 6 5 4 3 2 1 0} ----------------- |I|n|n|n|0|0|0|0| ----------------- \ / \ / --- ------ | }| | 0 = display blank lines | 0-7 = number of blank lines (1-8) 7 6 5 4 3 2 1 0 ---}-------------- |I|W| | |0|0|0|1| ----------------- | \ / | ------ | | } | 1 = jump (3 byte instruction) | 0 = jump and display one blank line 1 = jump and wait for ver}tical blank 7 6 5 4 3 2 1 0 ----------------- |I|R|H|V|M|M|M|M| ----------------- | | | | \ / } | | | | ------ | | | | | | | | | 2-F = display one line of graphics in | | | | ANTIC mode 2-}F | | | 1 = horizontal scroll enabled | | | | | 1 = vertical scroll enabled | | | 1 = reload memory }scan counter with next two bytes | 1 = display list interrupt, all instructionsIn the display instruction, the ANT}IC mode is different from the CIO graphics mode. However, each CIO graphics mode uses a particular ANTIC mode. Below are desc}riptions of the ANTIC modes with their associated graphics (CIO) modes.ANTIC MODE 2 (Graphics 0)Uses 8 pixel by 8 pixel ch}aracters, 40 characters horizontal, 8 TV scan lines vertical. Only one color can be displayed at a time.ANTIC MODE 38 X 10} pixel, Graphics 0 type characters. This mode requires a custom character set. The advantage is that it allows true decenders}. The custom C-set is still 8 X 8 pixels. Lower-case letters with decenders have the bottom row of pixels put on the top row.}Lower-case "y" for ANTIC mode 3 C-set Display ---------- ---------- | XXXXX | | |} | | | | | | | | | XX XX | | XX XX | | XX XX | | XX XX | } | XX XX | | XX XX | | XXXXX | | XXXXX | | XX | | XX | ---------- | XXXXX | } | | ----------ANTIC MODE 4 (graphics 12 on XL and XE)This mode has characters }the same size as graphics 0. However, the characters are only 4 X 8 pixels. This gives only half the horizontal resolution of} graphics 0. The advantage is that up to four colors of "graphics 0" characters can be displayed at once. This mode also requ}ires a custom C-set. Below is a comparison of the normal C-set to one which works with the ANTIC 4 mode. Upper-case "A" for A}NTIC modes 2 and 4 mode 2 mode 4 ---------- ---------- | | | | | XX }| | yy | | XXXX | | yy | | XX XX | |xx zz | | XX XX | |xx zz | | XXXXXX |} |xxyyzz | | XX XX | |xx zz | | | | | ---------- ----------xx, yy and zz re}present two bit binary numbers, controlling one pixel each. These numbers determine which color register a pixel is assigned }to: (COLOR0, COLOR1, COLOR2 or COLOR3).ANTIC mode 5Antic mode five is identical to ANTIC mode 4 except the characters are }displayed twice as tall. This makes only 12 lines on the screen.ANTIC MODE 6 (Graphics 1)This mode uses 8 X 8 pixel charac}ters except they are displayed twice as wide as in ANTIC mode 2. There are 3 colors available at once but only one case (uppe}r or lower) can be displayed at a time. The data base variable CHBAS [$02F4 (756)] controls the character, [$E0 (224) = upper}-case, $E2 (226) = lower-case]. The color/character is controlled by either the color statement or the ATASCII number of the }character printed. Control characters are controlled by COLOR0, upper-case characters by COLOR1 and lower-case characters by }COLOR2. Remember that all characters print as upper-case alpha characters, but of different colors.ANTIC MODE 7 (Graphics 2})This mode is identical to mode 6 except the characters are displayed twice as tall. This results in only 12 lines possible }on the screen.ANTIC MODE 8 (Graphics 3)This is the first graphics (non-character) mode. This mode, as other non-character  }graphics modes do, uses data in the display buffer as a bit map to be displayed. A command to display in mode 8 will cause th }e ANTIC chip to read the next 10 bytes in the display buffer. Each pair of bits will control one pixel as in mode 4. However, } the pixels are blocks the same size as a Graphics 0 (ANTIC 2) characters.ANTIC MODE 9 (Graphics 4)This is similar to ANTI }C mode 8 except each byte controls 8 pixels (instead of 4) and only one color can be displayed at a time. The pixels are also } half the size of those in ANTIC mode 8.ANTIC MODE A (Graphics 5)This mode uses 20 bytes per line/command. As in ANTIC mod}e 8, each pair of bits controls one pixel. The result is that the pixels are the same size as in ANTIC mode 9 but four colors} can be displayed at once.ANTIC MODE B (Graphics 6)As in mode A, there are 8 pixels per byte and only one color. The pixel}s are half the size as in mode A.ANTIC MODE CLike mode B except the pixels are half as tall (only one T.V. line).ANTIC M}ODE D (Graphics 7)40 Bytes per line, each byte controls 4 pixels. The pixels are 1/4 as large as in ANTIC mode 8 (Graphics 3}).ANTIC MODE E (Graphics 15 on XL and XE)Like mode D except the pixels are half as tall (one T.V. line). Antic mode E is s}ometimes called Graphics 7.5ANTIC mode F (Graphics 8, 9, 10 and 11)This is the highest resolution mode. Pixels are 1/8 the} size of ANTIC mode 8 or mode 2 characters. It uses 40 bytes per line, each byte controlling 8 pixels, unless the GTIA chip i}ntervenes. Only one color can be displayed at a time.0 bytes per line, each byte controlling 8 pixels, unless the GTIA chip i5008063CHAPTER 15.1. DISPLAY LIST EXAMPLESWhen CIO opens a channel to the screen, it sets up the proper display li}st for the ANTIC chip. The following are the things CIO must handle when setting up the display list. Display list duties as }used by CIO display a certain number of blank lines at the top of the screen. Load the memory scan counter with the address o}f the display data buffer. Display the required number of lines in the required ANTIC mode. Set up a jump instruction if the }display list crosses a 1K memory boundary. Set up a reload-memory-scan-counter instruction if the display data buffer crosses} a 4K memory boundary. CIO assumes that the display data buffer will butt against an 8K memory boundary. If a program causes }the display buffer to cross a 4K boundary (by changing RAMTOP [$006A (106)] to point to an address which is not at an 8K boun}dary) the screen will be scrambled. This is not usually a problem if the graphics mode doesn't require a large block of memor}y.SAMPLE DISPLAY LISTBelow is an example of a Graphics 0 display list as CIO would set it up. Display list for Graphics 0 }assuming BASIC starts at $A000address instruction explanation Dec. Hex.$9C20 112 $70 \ 112 } $70 >---- 24 blank lines (8 each command) 112 $70 / 66 $42 ----- load memory scan counter with !}$9C24 64 $40 \__ next two bytes and display one line 156 $9C / \ of ANTIC 2 characters 2 "} $02 -\ | 2 $02 | \- address of display data buffer 2 $02 | 2 $02 \--- 2nd ANTI#}C 2 instruction - --- 2 $02 ----- 24th ANTIC 2 instruction 65 $41 \ $} 32 $20 >---- jump back to start of list 156 $9C /$9C40 ??? ?? first byte of display data%} buffer --- --$9FFF ??? ?? last byte of buffer$A000 start of ROMA display &}list for a higher resolution graphics mode would require more instructions and might cross a 1K boundary. It would then inclu'}de a jump instruction to cross the boundary.MULTIPLE DISPLAYSIt is possible to set up multiple displays and use one at a t(}ime. The technique of changing from one display to another is called page flipping. Below is the simplest way to set up two d)}isplays. Setting up two displays: Call a graphics mode through CIO or by using a BASIC GRAPHICS command: Store the display li*}st pointers, SDLSTL and SDLSTH, and the CIO screen pointer, SAVMSC [$0058,2 (88)]. Move the start-of-ROM pointer, RAMTOP [$00+}6A (106)] to below the current display list. RAMTOP is a one byte pointer so it changes in increments of one page (256 bytes),}. Make another graphics call as in the first step. Store the new display list pointer and CIO screen pointer. This will set u-}p two displays, each with it's own display list. If the displays are in the same graphics mode, or you will not make any chan.}ges in the displays with CIO commands, (PLOT, PRINT, etc.) you can flip between the two simply by changing the display list p/}ointer. If the screens are in the same graphics mode and you want to change which one to do CIO commands to, Change the CIO s0}creen pointer, SAVMSC [$0058,2 (88)]. This way, you can display one screen while drawing on the other. If you want to do CIO 1}commands to screens of different graphics modes, you will have the move RAMTOP and do a graphics call to change screens. If y2}our manipulation of RAMTOP causes the display data buffer to cross a 4K boundary, the screen may be scrambled.DISPLAY LIST 3}INTERRUPTSDLIs are not used by the operating system. However, other programs can initiate and use them. Use the following st4}eps to set up display list interrupts. Setting up DLIs: Set bit 7 of the display list instruction for the line before you wan5}t the interrupt to occur. (The interrupt routine should set WSYNC and wait for the next line to execute.) Set bit 7 of NMIEN 6}[$D40E (54286)] to enable DLIs. Set the DLI routine vector, VDSLST [$0200,2 (512)] to point to your machine language DLI rout7}ine. Your DLI routine should set WSYNC [$D40A (54282)]. STA WSYNC will do. THis will cause the 6502 to wait for the next hori8}zontal sync. This will keep the DLI routine from changing something in the middle of a T.V. line. The DLI routine must end wi9}th an RTI instruction.SCROLLINGScrolling is controlled by a combination of scroll position registers, and changing the mem:}ory scan counter. Basically, course scrolling is done by reloading the memory scan counter and fine scrolling is done by chan;}ging the scroll registers.VERTICAL SCROLLINGVertical scrolling is very simple. Follow the steps below to set up vertical <}scrolling of graphics. Steps to use vertical scrolling. Set bit 4 of the first byte of the display list instruction for each =}line to be scrolled. Put the number of T.V. lines to offset the graphics vertically in the vertical scroll register, VSCROL [>}$D405 (54277)]. The vertical scroll register can offset the graphics upward by 0 - 7 T.V. lines in the 24 line graphics modes?} (ANTIC modes 2 and 4). In 12 line graphics modes (ANTIC modes 5 and 7) it can vertically offset the graphics by 0 - 15 T.V. @}lines. To offset the graphics an 8th (or 16th) line, the scroll register is reset to 0 and the memory scan counter is reloadeA}d with the address of the next line of graphics in the display data buffer. If the entire screen is being scrolled, the load-B}memory-scan-counter command (near the beginning of the display list) is changed to point to the address of the second line ofC} graphics.HORIZONTAL SCROLLINGHorizontal scrolling works much like vertical scrolling. It is enabled by setting bit 5 of tD}he instruction for each line to be scrolled. The horizontal scroll register, HSCROL [$D404 (54276)], sets the offset. The smaE}ll difference is that graphics are moved twice as far per change (two graphics 8 pixels instead of one). Also, when HSCROL = F}0 the graphics are offset beyond the left edge of the screen by 16 color clocks (32 Graphics 8 pixels). When HSCROL = 15, theG} graphics line is shifted one color clock (2 Graphics 8 pixels) to the left of the screen. The big difference is that the memH}ory scan counter gets messed up. This means that you must use a reload-memory-scan-counter command for each line of graphics.I} This is a major modification of the display list. It will require you to move and build the list yourself. The advantage of J}this is that you can have a scrolling window in a large graphics map. The technique is to move the window by reloading the meK}mory scan counter, then fine scrolling to the invisible bytes beyond the edges of the screen. Useful data base variables and L}OS equatesSAVMSC $0058,2 (88): pointer to current screen for CIO commandsRAMTOP $006A (106): start-of-ROM poinM}ter (MSB only)VDSLST $0200,2 (512): DLI vectorRAMSIZ $02E4 (740): permanent start-of-ROM pointer (MSB only)DLIN}STL $D402 (54274): display list pointer low byteDLISTH $D403 (54275): " high byteHSCROL $D404 (54276)O}: horizontal scroll registerVSCROL $D405 (54277): vertical scroll registerNMIEN $D40E (54286): NMI enable (DLIs)P}Shadow registersSDLSTL $0230 (560): DLISTLSDLSTH $0231 (561): DLISTHN $D40E (54286): NMI enable (DLIs)U008063CHAPTER 16. PLAYER AND MISSILE (PM) GRAPHICSPlayers and missiles (called sprites on some computers) are movR}able objects which are independent of the normal graphics. Player and missile graphics are fairly straight forward. Once the S}computer is set-up for PM graphics, five 8-pixel-wide columns can be displayed on the screen. The horizontal resolution (widtT}h of each pixel) and the vertical resolution (number of scan lines per pixel) are variable. The horizontal position of each cU}olumn is determined by it's horizontal position register. Each column is simply a representation of a bit map in a certain blV}ock of memory. If you want to draw an object on the screen, you simply put a bit map representing it in the proper memory bloW}ck. The vertical position of an object is determined by the location of it's bit map in memory. For example, if you want to dX}raw a happy face in the middle of the screen, you put a happy face bit map in the middle of one of the memory blocks controllY}ing one of the columns. One column (player) displayed on the screen ---------- first byte of a block | Z} | | | ------------------------------ | | | | | | | [} | | | | | | | | | | | | | | \}| | | | | ++++ | visible | | | + + | | | |+ + + +| ]} | | |+ +| area | | |++ ++| | | |+ ++++ +|--object | | ^} | + + | bit map | | | ++++ | | | | | | | | | _} | | | | | ------------------------------ | | | | `} ---------- last byte of a block Horizontal positions$00 $30 $CE $FF(0) (48) a} (206) (255) | | | | | Left edge right edge | | b} | Far left far rightTo move the happy face vertically you would mc}ove the entire bit map in memory. To move the happy face horizontally you change the number in the horizontal position registd}er for the proper player. One of the players can be (and often is) split into four columns of two pixels wide each. These cole}umns are then called missiles. In this case, each missile has it's own horizontal position register.SETTING UP PM GRAPHICSf}PM graphics are enabled by the direct memory access control register, DMACTL [$D400 (54272)]. The program using PM graphics wg}ill usually use the shadow register, SDMCTL [$022F (559)].DMACTL (SDMCTL) 7 6 5 4 3 2 1 0 ----------------- |0q}b%DOS SYSb*)DUP SYSbCSAUTORUN SYSb2CHAPT13 bCHAPT14 b9CHAPT15 b;CHAPT15 1 b1QCHAPT16 bBCHAPT16 1 b)CHAPT17 b5CHAPT18 b+CHAPT19 b-ECHAPT20 b0rOSEQU #?APNDXA 1 #?APNDXA #-!APNDXA 2 #KNAPNDXB #EAPNDXB 1 # GRAFMAC LIB|0| control | ----------------- bits 5 1 = enable display list reading 4 0 = one line player resolutior}n 1 = two line player resolution 3 1 = enable four players 2 1 = enable fifth player or missiles 1s} & 0 00 = no background 01 = narrow background (128 color clocks, 1 color clock equals 2 GRAPHICS 8 t}pixels) 10 = normal background (160 color clocks) 11 = wide background (192 color clocks)Normally, bits 5 u}and 1 are set to 1. Bits 4, 3 and 2 are used to enable players and/or missiles accordingly. Once DMACTL is set up for the tyv}pe of PM graphics to enable, the graphics control register, GRACTL [$D01D (53277)], is used to actually enable the PM graphicw}s.GRACTL 7 6 5 4 3 2 1 0 ----------------- |not used | | | | ----------------- Bits 2 1 = latch px}addle triggers 1 1 = enable four players 0 1 = enable fifth player or missilesIf only DMACTL is set up, the y}ANTIC chip will access memory for PM graphics but will not display them. Next, the memory area used for the PM bit maps must z}be set. This block must start on a 2K (8 page) boundary if single line resolution is used and a 1K (4 page) boundary for two {}line resolution. The page number where the bit map starts is stored in the PM base register, PMBASE [$D407 (54279)]. For one |}line resolution this number will be a multiple of 8. For two line resolution it will be a multiple of 4. PMBASE holds the MSB}} of the address of the PM bit map. The LSB will always be 0 so it need not be specified.The PM bit maps 2 line resolutio~}n 128 bytes (1/2 page) per player ----------------- start + 0 | |\ +---------------+} 1-1/2 page | | (384 bytes) +===============+ unused | |/ +---------------+ }+$180 (384) |M3 |M2 |M1 |M0 | fifth player or missiles +===============+ +$200 (512) | player 0 map | +}---------------+ +$280 (640) | player 1 map | +===============+ +$300 (768) | player 2 map | +-------}--------+ +$380 (896) | player 3 map | +===============+ +$400 (1024) 1 line resolution 256 bytes (1 }page) per player ----------------- start + 0 | |\ + + | }| +===============+ | | 768 bytes + + | | (3 pages) +===}============| | | unused + + | |/ +===============+ +$300 (76}8) | | | | | fifth player +M3 |M2 |M1 |M0 | or missiles | | | | | +===============+ +$40}0 (1024) | | + player 0 map + | | +===============+ +$500 (1280) | } | + player 1 map + | | +===============+ +$600 (1536) | | +} player 2 map + | | +===============+ +$700 (1792) | | + player 3 map + } | | +===============+ +$800 (2048)====+ +$700 (1792) | | + player 3 map + 9008063Example of using P/M graphics in BASIC0 REM ---LABEL REGISTERS ETC10 LINES=220 VERT=12022 IF LINES=2 THEN!} VERT=VERT/230 PM0=102432 IF LINES=2 THEN PM0=PM0/240 HORIZ=12050 PCOLR0=70460 SDMCTL=55970 SIZEP0=5325680 HPOSP0=5324!}890 SDMCTL=559100 PMRAM=PEEK(106)-16110 PMBASE=54279120 GRACTL=53277130 PMSTART=PMRAM*256+PM0200 REM ---SET REGISTERS2!}10 POKE SDMCTL,62212 IF LINES=2 THEN POKE SDMCTL,46220 POKE SIZEP0,1230 POKE HPOSP0,HORIZ240 POKE PCOLR0,88250 POKE PMBA!}SE,PMRAM260 POKE GRACTL,3300 REM ---DRAW PLAYER310 POKE PMSTART+VERT,60320 POKE PMSTART+VERT+1,66330 POKE PMSTART+VERT+2!},165340 POKE PMSTART+VERT+3,129350 POKE PMSTART+VERT+4,195360 POKE PMSTART+VERT+5,189370 POKE PMSTART+VERT+6,66380 POKE !}PMSTART+VERT+7,60The above program will draw a happy face in about the middle of the screen using player 0. To move the play!}er horizontally, poke a different number into HPOSP0. To draw the player in a different vertical position, change VERT. To us!}e a different player or missile, use the memory maps above to find the starting address of the player you want to use. For ex!}ample, to use player 1 change line 40 to PM1=1280. Then change line 130 to PMSTART=PMRAM*256+PM1. The variable "LINES" determ!}ines the vertical resolution. The number poked into SIZEP0 determines the width.P/M PRIORITYThe priorities of players, mis!}siles and non-P/M graphics can be controlled by the PRIOR register [$D10B (53275)] and its shadow register, GPRIOR [$26F (623!})]. Objects with higher priority will appear to move in front of lower priority objects. The format of PRIOR is as follows:!}PRIOR bit assignment 7 6 5 4 3 2 1 0 ----------------- | | | | | | | | | ----------------- 1 6 3 1!} 8 4 2 1 2 4 2 6 8Bits 7-6 Control the GTIA graphics modes. 00 = normal 01 = mode 9 !} 10 = mode 10 11 = mode 11 5 1 = multiple color player enable. Permits overlapping of players 0 and 1 or !}2 and 3 with a third color in the overlapped region. 4 1 = fifth player enable. All missiles will assume the color co!}ntrolled by COLOR3 [$2C7 (711)]. missiles are positioned together to make the fifth player. 3-0 Controls the prioriti!}es of players, missiles and other graphics. Objects with higher priority will appear to move in front of those with lower pr!}iority. The following chart may need some clarification. In the chart:PM0 = player 0 and missile 0 C0 = COLOR0, plotted gra!}phics controlled by color register 0 in the SETCOLOR command. P5 = all four missiles when combined into one player.BAK = th!}e background, known as COLOR4 or color register 4 in the SETCOLOR command. Etc.Bits 0-3 of PRIOR and P/M prioritiesBit 3=1!} 2=1 1=1 0=1 C0 C0 PM0 PM0 highest C1 C1 PM1 PM1 priority PM0 C2 C0!} PM2 PM1 C3+P5 C1 PM3 PM2 PM0 C2 C0 PM3 PM1 C3+P5 C1 C2 PM2 PM2 !}C2 C3+P5 PM3 PM3 C3+P5 lowest BAK BAK BAK BAK priorityOnly one priority bit can be set at a time!}. If more than one priority bit is 1, overlapping areas of conflicting priorities will turn black.COLLISIONSEach player or!} missile has a register showing overlap (collisions) with other objects. Each player has two registers assigned to it; one to!} detect collisions with other players and one to detect collisions with plotted objects. Likewise each missile has two regist!}ers; one to detect collisions with players and one to detect collisions with plotted objects. Careful use of these 16 registe!}rs can detect any type of collision. Each register uses only the lower 4 bits. The bits which equal 1 tell what the associat!}ed object has collided with. For example, to detect collisions of player 1 to other players examine P1PL [$D00D (53261)].P1!}PL, player 1 to player collisions 7 6 5 4 3 2 1 0 -----------------P1PL |unused | | | | | -----------------!} 8 4 3 = 1 collision with player 3 2 = 1 collision with player 2 1 = 1 invalid 0 = 1 col!}lision with player 0 Etc.When looking for collisions with plotted objects, the bit number tells what color register is assig!}ned to the object the collision was with. For example, to detect collisions between player 1 and plotted objects (officially !}called the play field), P1PF [$D005 (53253)] is used. P1PF, player 1 to ploted object collisions 7 6 5 4 3 2 1 0 -!}----------------P1PF |unused | | | | | ----------------- 8 4 2 1 3 = 1 collision with COLOR3 2!} = 1 " COLOR2 1 = 1 " COLOR1 0 = 1 " COLOR0 Etc.Once a collision occurs!} it remains indicated in its collision register. To clear out all collision registers, write anything to HITCLR [$D01E (53278!})]. STA HITCLR or POKE 53278,0 will do. Useful database variables and OS equatesHPOSP0 $D000 (53248): write: horizontal !}position of player 0M0PF " " : read: missile 0 to plotted graphics collisionsHPOSP1 $D001 (53249): write!}: horizontal position of player 1M1PF " " : read: missile 1 to plotted graphics collisionsHPOSP2 $D002 (!}53250): write: horizontal position of player 2M2PF " " : read: missile 2 to plotted graphics collisionsHPOSP!}3 $D003 (53251): write: horizontal position of player 3M3PF " " : read: missile 3 to plotted graphics col!}lisionsHPOSM0 $D004 (53252): write: horizontal position of missile 0P0PF " " : read: Player 0 to plotted!} graphics collisionsHPOSM1 $D005 (53253): write: horizontal position of missile 1P1PF " " : read: Player!} 1 to plotted graphics collisionsHPOSM2 $D006 (53254): write: horizontal position of missile 2P2PF " " :!} read: Player 2 to plotted graphics collisionsHPOSM3 $D007 (53255): write: horizontal position of missile 3P3PF " !} " : read: Player 3 to plotted graphics collisionsSIZEP0 $D008 (53256): write: size of player 0M0PL " !} " : read: missile 0 to player collisionsSIZEP1 $D009 (53257): write: size of player 1M1PL " " : r!}ead: missile 1 to player collisionsSIZEP2 $D00A (53258): write: size of player 2M2PL " " : read: missile!} 2 to player collisionsSIZEP3 $D00B (53259): write: size of player 3M3PL " " : read: missile 3 to player!} collisionsSIZEM $D00C (53260): write: widths for all missilesP0PL " " : read: player 0 to other player!} collisionsGRAFP0 $D00D (53261): write: player 0 graphics (used by OS)P1PL " " : read: player 1 to other!} player collisionsGRAPF1 $D00E (53262): write: player 1 graphicsP2PL " " : read: player 2 to other playe!}r collisionsGRAFP2 $D00F (53263): write: player 2 graphicsP3PL " " : read: player 3 to other player coll!}isionsGRAPF3 $D010 (53264): write: player 3 graphicsGRAFM $D011 (53265): write: missile graphics (used by OS)COLP!}M0 $D012 (53266): color for player/missile 0COLPM1 $D013 (53267): 1COLPM2 $D014 (53268!}): 2COLPM3 $D015 (53269): 3COLPF0 $D016 (53270): color register 0!}COLPF1 $D017 (53271): 1COLPF2 $D018 (53272): 2COLPF3 $D019 (53273): !} 3COLBK $D01A (53274): background color (register 4)PRIOR $D01B (53275): priority select, GTIA modesGRACTL $D0!}1D (53277): graphics controlHITCLR $D01E (53278): writing anything clears all collision bitsDMACTL $D400 (54272!}): direct memory access (DMA) controlPMBASE $D407 (54279): start of P/M memoryShadow registersSDMCTL $022F (559!}): DMACTLGPRIOR $026F (623): PRIORPCOLR0 $02C0 (704): COLPM0PCOLR1 $02C1 (705): COLPM1PCOLR2 $02C2 !} (706): COLPM2PCOLR3 $02C3 (707): COLPM3COLOR0 $02C4 (708): COLPF0COLOR1 $02C5 (709): COLPF1COLOR2 $02!}C6 (710): COLPF2COLOR3 $02C7 (711): COLPF3COLOR4 $02C8 (712): COLBK1 $02C5 (709): COLPF1COLOR2 $02 WCHAPTER 17. SOUNDGenerating sound can be very simple. For simple sounds there are four audio channels, each controlled by t%}wo control registers.GENERATING SOUNDSTo generate a sound in channel 1, put the frequency and volume codes into the freque%}ncy and control registers. The frequency register for channel 1, AUDF1 [$D200 (53760)] can have any number from 0 to $FF (255%}). 0 causes the highest frequency; 255 causes the lowest. The volume/noise (control) register for channel 1, AUDC1 [$D201 (53%}761)] is more complicated.Audio channel control (volume/noise) register 7 6 5 4 3 2 1 0 -----------------AUD%}Cx | noise | volume| ----------------- 1 6 3 1 8 4 2 1 2 4 2 6 8The noise bits can have vari%}ous values. The best way to learn to use them is by experimentation. The technical details of the polynomial counters which g%}enerate the noise has little bearing on what is heard. The two special values of interest are: $1 (volume+16 in decimal), whi%}ch causes a DC voltage proportional to the volume bits and; $A (volume+160), which causes a pure tone (square wave). The volu%}me bits select the relative volume, 0=off. Therefore, the number, $A8 (168 [8+160]) in AUDC1, will cause the frequency select%}ed by AUDF1 to be a pure tone of medium volume. In BASIC the dirty work is done for you. The SOUND command will do all the ca%}lculations for you. The Sound command format is shown below.The BASIC sound command format SOUND channel,frequency,noise,vo%}lumeThe channel numbers is 0 to 3 instead of 1 to 4.The frequency, 0 to 255, is put into the frequency register. The noise i%}s put into the high bits of the channel control register with volume in the low bits. Therefore... SOUND 0,125,10,8 will pro%}duce a pure tone of medium frequency and volume in channel 0 (called channel 1 in assembly language).ADVANCED SOUNDThe Aud%}io Control register, AUDCTL [$D208 (53768)], (not to be confused with the four audio channel control registers), adds more co%}ntrol for assembly language programmers. Again, to go into technical details will be less productive than experimentation. Th%}e audio control register. (AUDCTL) 7 6 5 4 3 2 1 0 ----------------- AUDCTL | | | | | | | | | -----%}------------ 1 6 3 1 8 4 2 1 2 4 2 6 8 7 0 = 17 bit polynomial noise 1 = 9 bit%} below polynomial noise 6 0 = clock channel 1 with 64 KHz 1 = clock channel 1 with 1.79 MHz 5 0 =%} clock channel 3 with 64 KHz 1 = clock channel 3 with 1.79 MHz 4 0 = clock channel 2 with 64 KHz %} 1 = clock channel 2 with channel 1 3 0 = clock channel 4 with 64 KHz 1 = clock channel 4 with channel%} 3 2 1 = insert logical high-pass filter in channel 1, clocked by channel 3 1 1 = insert logical high-pass %}filter in channel 2, clocked by channel 4 0 0 = 64 KHz main clock 1 = 16 KHz main clockAll bits of AUDCT%}L are normally zero. The BASIC sound command causes it to be reset to zero. By clocking one channel with another, the range c%}an be increased. This essentially allows two channels with twice the range as each of the four normal channels. This is calle%}d 16 bit sound. To calculate exact frequencies, use the following formulas. The exact clock frequencies are also given if mor%}e accuracy is needed. The clock frequencies are acquired by dividing the signal from the TV color-burst crystal. This crystal%} has a frequency of 3.579545 MHz. Clock frequencies: 1.7897725 MHz (color-burst/2) 63.920446 Khz (color-bur%}st/56) 15.699759 KHz (Color-burst/228)Formulas: For 1.79 MHz clock clock %} f = ------------ f = ------------ 2(AUDFn + 7) 2(AUDFn + 4) 16 bit %} 8 bit AUDFn is the number in the audio frequency register. For 16 KHz and 64 KHz clock %} f = ------------ 2(AUDFn + 1)AUDIO TIMER INTERRUPTSWhen the audio timers count down to zero they gene%}rate IRQ interrupts (if enabled). The timers can be reset by writing any number to STIMER [D209 (53769)].THE CONSOLE SPEAKE%}RThe console speaker is where key clicks and the cassette signals come from. On XL and XE models this speaker is heard throu%}gh the TV speaker. It is operated by toggling bit 3 of CONSOL [$D01F (53279). This bit always reads 0 but it is actually set %}to 1 during vertical blank. Useful data base variables and OS equatesCONSOL $D01F (53279): bit 3 controls console s%}peakerAUDF1 $D200 (53760): Audio frequency 1AUDC1 $D201 (53761): audio control 1AUDF2 $D202 %}(53762):AUDC2 $D203 (53763):AUDF3 $D204 (53764):AUDC3 $D205 (53765):AUDF4 $D206 (%}53766):AUDC4 $D207 (53767):AUDCTL $D208 (53768): general audio controlSTIMER $D209 (53769): au%}dio timer reset$D207 (53767):AUDCTL $D208 (53768): general audio controlSTIMER $D209 (53769): au$008063CHAPTER 18. THE JOYSTICK PORTSThe joystick ports are the I/O ports of the PIA chip. This means that they )}are bidirectional, capable of output as well as input. The joystick ports are usually set up for input. To read them, simply )}read the port registers. PORTA [$D300 (53016)] will read joystick ports 1 and 2. PORTB [$D301 (54017)] will read joystick por)}ts 3 and 4. Joystick ports 3 and 4 are used for memory control on the XL/XE models and don't have external connectors. Each b)}it of each port can be configured independently for input or output. To reconfigure a port, the port control registers, PACTL)} and PBCTL [$D302 (54018) and $D303 (54019)], are used. The port control registers also control some lines on the serial I/O )}connector. The port control registers 7 6 5 4 3 2 1 0PACTL -----------------or |n 0 1 1 n n 0 n|PBCT)}L ----------------- 1 6 3 1 8 4 2 1 2 4 2 6 8 bits PACTL 7 )} Peripheral A interrupt status. Set by peripheral interrupt; reset by reading PORTA. 3 Cassette motor control (0 = on)}: 1 = off). 2 0 = PORTA is now port A direction control. Writing to PORTA will now set bits for input or output. *} 0 sets bit for input; 1 sets bit for output. 1 = PORTA operational. 1 1 = peripheral A interrupt enabled. *} PBCTL 7 Peripheral B interrupt status. Set by peripheral interrupt; reset by reading PORTB. 3 Seria*}l connector command line. 2 0 = PORTB is now port B direction control. Writing to PORTB will now set bits for input o*}r output. 0 sets bit for input; 1 sets bit for output. 1 = PORTB operational. 1 1 = peripheral B interrupt enabled.The el*}ectronic configuration of the controller ports is as follows. ----------- ----------- \0 1 2 3 R/ \4 5 6 7 R/ *} \t + - L/ \t + - L/ ------- ------- 0 through 7 are the binary data bits for port A or port B.+*} and - are +5 volts and ground respectively.R and L are the left and right game paddles.t is the joystick trigger line.The*} data bits in the joystick ports are used as follows for the joysticks and game paddles.The joysticks and the port registers*} 7 6 5 4 3 2 1 0 -----------------PORTA |U|D|L|R|U|D|L|R| ----------------- 1 * }6 3 1 8 4 2 1 2 4 2 6 8paddle | | | |triggers 3 2 1 0PORTB -----------------(40* }0/800 |U|D|L|R|U|D|L|R|only) -----------------paddle | | | |triggers 7 6 5 4 U = up D = dow* }n L = left R = rightThe joysticks may be read either directly from the port registers or from the joystick sha* }dow registers. During vertical blank, the data in the port registers is separated and put into the shadow registers. These r* }egisters are, STICK0 [$0278 (632)], STICK1 [$0279 (633)], STICK2 [$027A (634)] and STICK3 [$027B (635)]. The triggers may be *}read from the joystick trigger registers, TRIG0 - TRIG3 [$D010 - $D013 (53264 - 53267)]. These register have shadow registers*}, STRIG0 - STRIG3 [$0284 - 0287 (644 -647)]. If these registers read zero the associated triggers are pressed.The paddle trig*}gers may be read from their shadow registers also. They are, PTRIG0 - PTRIG 7, [$027C - $0283 (236 - 643)].THE GAME PADDLE *}REGISTERSAlthough the game paddles are plugged into the joystick ports, they are not read from the port registers. The game *}paddles are read by first writing any number to the start-pot-scan register, POTGO [$D20B (53771)]]. This turns off the capac*}itor dump transistors and allows the pot reading capacitors to begin charging. It also sets the TV scan line counter to zero.*} As each capacitor crosses a certain trigger voltage, the number of TV lines scanned is put in the respective pot value regis*}ter. When the scan counter reaches 228, the capacitor dump transistors are turned on and the number 228 is put into any pot v*}alue registers which are still empty. Before reading the pot value registers, ALLPOT [$D208 (53768)] should be checked. In th*}is register, each bit corresponds to the validity of a pot value register. If a bit is zero, its' associated pot value regist*}er is valid. If bit 2 of SKCTL, [$D20F (53775)], is 1, the pots go into the fast scan mode. In this mode the paddles are read*} in only 2 TV scan lines. They can also be read without regard to POTGO or ALLPOT. The pot value registers contain the number*} of TV scan lines it last took for the paddle reading capacitors to charge (up to 228). These registers are POT0 - POT7 [$D20*}0 - $D207 (53760 -53767)]. Their shadow registers are PADDL0 - PADDL7 [$0270 - $0277 (624 - 631)].THE LIGHT PEN REGISTERSW*}henever a joystick trigger is pressed, the light pen registers, PENH and PENV are updated. PENH [$D40C (54284)] takes a value*} based on a color clock counter. The value can be from 0 to 227. PENV [$D40D [54285)] takes the 8 highest bits of the vertica*}l line counter. A light pen is simply a photo transistor connected to a joystick trigger line and focused on the TV screen. W*}hen the electron beam strikes the part of the screen the light pen is focused on, the transistor turns on pulling the trigger* } line low. The light pen registers then contain numbers relative to where the light pen was pointing. The shadow register for*!} PENH and PENV are LPENH [$0234 (564)] and LPENV [$0235 (566)). Useful operating system equatesTRIG0 $D010 (53264)*"}: joystick triggers |TRIG3 $D013 (53268):POT0 $D200 (53760): paddle value |POT7 $D207 *#} (53767):ALLPOT $D208 (53768): reads validity of pot valuesPOTGO $D20B (53771): starts paddle readSKCT*$}L $D20F (53775): bit 2 enables fast pot scanPORTA $D300 (53016): port A dataPORTB $D301 (5301*%}7): port B dataPACTL $D302 (54018): port A controlPBCTL $D303 (54019): port B controlPENH $D40C *&} (54284): light pen horizontal value PENV $D40D (54285): light pen vertical valueShadow registersLPENH $0*'}234 (564): light pen horizontal valueLPENV $0235 (566): light pen vertical valuePADDL0 $0270 *(} (624): game paddle values |PADDL7 $0277 (631)STICK0 $0278 (632): joystick registers |S*)}TICK0 $027B (635):PRTIG0 $027C (636): paddle triggers |PTRIG7 $0283 (643):STRIG0 $02**}84 (644): joystick triggers |STRIG3 $0287 (647): |PTRIG7 $0283 (643):STRIG0 $02(L008063 CHAPTER 19. MISC HARDWARE REGISTERS AND INFORMATIONVERTICAL LINE COUNTERThe ANTIC chip has a vertical .,}line counter at $0D4B (54283). This counter shows the high 8 bits of a 9 bit counter. This gives two line resolution. The val.-}ue of this counter is placed into PENV [$D40D (54285)] when a joystick trigger is pressed.SERIAL PORT REGISTERSThe POKEY c..}hip has some registers which control the serial port. The serial port control register, SKCTL [$D20F (53775)], controls the s./}erial port configuration and the game paddle scan mode and some keyboard circuitry.The serial port control register .0} 7 6 5 4 3 2 1 0 ----------------- SKCTL | | | | | | | | | ----------------- 1 6 3 .1}1 8 4 2 1 2 4 2 6 8 bits 0 1 = enable keyboard debounce 1 1 = enable keyboard scan.2} both 0 = set initialization mode. 2 1 = fast pot scan 3 1 = serial output is two tone (for cassette) ins.3}tead of logical true/false 4\ 5 >- serial port mode control 6/ 7 1 = forced logical 0 on outputIf the.4} serial port control register is read from it gives the serial port status. The register is then called SKSTATSerial port st.5}atus register 7 6 5 4 3 2 1 0 ----------------- | | | | | | | |1| ----------------- 1 6 3 1 8 4 2 .6}1 2 4 2 6 8 bits 0 not used, reads 1 1 0 = serial input shift register busy 2 0 = last .7}key is still pressed 3 0 = shift key pressed 4 0 = direct from serial input port 5 0 = keyboard over-.8}run 6 0 = serial data input over-run 7 1 = serial data input frame errorThe serial port status is latched an.9}d must be reset by writing any number to its' reset register, SKRES [$D20A (53770)].SERIAL PORT INPUT AND OUTPUT DATAWhen .:}a full byte of serial input data has been received, it is read from the serial input data register, SERIN [$D20D (53773). Ser.;}ial output data is written to the same register, which is then called the serial output data register, SEROUT. This register .<}is usually written to in response to a serial output data interrupt (bit 4 of IRQST).HARDWARE CHIP MEMORY ALLOCATIONThe ad.=}dresses for the hardware chips are not completely decoded. For example, the PIA needs only four bytes of memory but is active.>} from $D300 - D3FF. Enough room for 64 PIA chips. A second pair of parallel ports could be added by accessing the address bus.?} and further decoding the address for a second PIA. (This would also require a small modification of the computer's circuit b.@}oard to disable the original PIA when the new one is active.) Similarly, there is room for 15 more POKEY or ANTIC chips and .A}7 gtia chips, should you ever need them. (GTIA uses $D000 - D0FF, POKEY uses $D200 - $D2FF and ANTIC uses $D400 - $D4FF.) Use.B}ful data base variables and OS equatesSKRES $D20A (53770): serial port status resetSEROUT $D20D (53773): serial ou.C}tput dataSERIN $D20D (53773): serial input dataSKCTL $D20F (53775): serial port controlSKSTAT $D20F (53775):.D} serial port statusVCOUNT $D40B (54283): vertical line counterOs shadow registersSSKCTL $0232 (562): SKCTL775):,x008063 CHAPTER 20. THE XL AND XE MODELSBASIC B BUGSMost of the Atari 600XL and 800XL models were supplied with2F} the "debugged" version B of Atari BASIC. This new BASIC got rid of the minor bugs of BASIC A and introduced some new major b2G}ugs of it's own. Each time a program is saved, 16 extra bytes are tagged onto the end of the program. After many saves and r2H}eloads, as when developing a long program, the program becomes too large for the memory. The computer may lock up unpredictab2I}ly. Program line links may get messed up, leaving garbage in the listing and the program unrunable. Large LISTed programs may2J} not run unless SAVed and reLOADed. If the length of a listed program is a multiple of a certain number of bytes, it will not2K} run unless the length is somehow changed. BASIC version B has been replaced by version C. All of the XE models have this tru2L}ly debugged version of BASIC.NEW OPERATING SYSTEM PROBLEMSI have heard of only one bug in the operating system in XL and X2M}E models. This is a mishandling of the printer timeout. The computer cannot tell if there is a printer attached or not. This 2N}may have been fixed in the XE models. However, many programs, some even formerly sold by Atari, do not jump through published2O} jump vectors when using the operating system. These programs will not run on XL/XE models. (Some of these programs are Atari2P} Word Processor (not Atariwriter) and LJKs Letter Perfect and Data Perfect.) Since the operating system ROM can be switched 2Q}to RAM, a "translator" can be used to load the 800 operating system into an XL or XE model.130XE MEMORY MANAGEMENTThe 130X2R}E has an extra 64K bank of memory. It is divided into four blocks of 16K each. Each block can be switched to replace part of 2S}the main bank of RAM from $4000 (16384) to $7FFF (32767). Furthermore, it can be switched in such a way that only the 6502, o2T}r the ANTIC chip can see the extra memory. Port B (formerly the two extra joystick ports of the 400/800) is used to manage th2U}e memory. Port B and memory management: 7 6 5 4 3 2 1 0 -----------------PORTB |T|U|A|C|S S|B|R| 2V} ----------------- 1 6 3 1 8 4 2 1 2 4 2 6 8 R 1 = OS replaced by RAM B2W} 0 = BASIC enabled S S bank select bits C 0 = CPU sees switched RAM at $4000 A 0 = ANTIC sees switched R2X}AM U unused T 0 = self testBits 2 and 3 of PORTB select which block of the extra bank of memory is switched in2Y}.Bank select bits bits block 2 3 address ------------------------- 0 0 $0000 - $3FFF 2Z} 0 1 $4000 - $7FFF 1 0 $8000 - $BFFF 1 1 $C000 - $FFFFBits 4 and 5 select which chip sees the s2[}witched in RAM at $4000 - $7FFFChip select bits bits ANTIC 6502 4 5 -------------------------- 02\} 0 Ext. Ext. 0 1 Ext. Main 1 0 Main Ext. 1 1 Main MainTHE XL PARA2]}LLEL PORT Pin out of the parallel port top from rear 111112222233333444445 24682^}024680246802468024680 ------------------------- ------------------------- 11111222223333342_}4444 1357913579135791357913579 1 2 GND 3 A1 4 A0 5 A3 6 A2`}2 7 A5 8 A4 9 GND 10 A6 11 A8 12 A7 13 A10 14 A9 15 A2a}12 16 A11 17 A14 18 A13 19 A15 20 GND 21 D1 22 D0 23 D3 22b}4 D2 25 D5 26 D4 27 D7 28 D6 29 GND 30 GND 31 GND 32 phase 2 2c}clock 33 RESET 34 35 RDY 36 IRQ 37 37 39 40 41 GND 42d}2 43 RAS 44 45 R/W 46 GND 47 +5V 48 +5V 49 GND 50The phase 2 clock r2e}uns at 1.8 MHz. When the clock is high, the address and R/W lines are valid. The clock goes from high to low, when the data l2f}ines are also valid. All lines then become invalid. The 130XE doesn't have the parallel port. However, it has a cartridge slo2g}t expansion. This is a small cartridge-slot-like connector with the necessary connector to use parallel expansion.FINE SCRO2h}LLINGIf address $026E (622) is $FF, graphics 0 will be in the fine scroll mode.OTHER ADDRESSESDSCTLN [$0D25,2 (725)] is t2i}he disk sector size. should be $80 (128).DMASAV [$02DD (735)] is a copy of the DMA control register, SDMCTL [$022F (559)]. 2j}It is set up when a channel is opened to the screen. The value is moved to SDMCTL whenever a key is pressed. It is used to re2k}store the display if DMA is disabled.PUPBT [$033D,3 (829-831)] is used to test memory integrity when [RESET] is pressed. If 2l}these bytes are not $5C, $93 and $25, the computer will do a cold start when [RESET] is pressed. The self-test ROM is from $D2m}000 to $D7FF, the same addresses as the hardware registers. This part of the operating system ROM is disabled when not used. 2n} When The computer is put into the self-test mode, This part of ROM is copied to $5000 to $57FF and run from there. GINTLK [$2o}03FA (1018)] is a logical 1 if a cartridge is installed (built-in BASIC is considered a cartridge). BASIC can be disabled by 2p}poking 1018 with a non-zero number. If [RESET] is then pressed, the computer will attempt to load the DUP.SYS file and basic 2q}will be completely disabled.number. If [RESET] is then pressed, the computer will attempt to load the DUP.SYS file and basic 0008063(NOTE:- OWN IDEA OF OSEQU.M65 MEANING, NOT WRITTEN BY AUTHOR.)Operating Sysytem Equates for the MAC 65 ASSE6s}MBLY LANGUAGE cartridge. THE MAC 65 CARTRIDGE HAS NOW BEEN DUMPED TO DISK BUT IS NOT AVAILABLE COMMERCIALLY!!!)NOTE ENDS.06t}100 ; OSEQU.M650110 ;0120 OSEQU0130 ;0140 ;USEFUL OPERATING SYSTEM EQUATES0150 ;INCLUDING FMS AND SOME GENERAL6u} 0131 ;PROGRAM EQUATES0160 ;0170 ;0180 ;CIO BYTE VALUES0190 ;0200 OPEN = $030210 OREAD = $040220 GETREC = $050230 O6v}DIR = $060240 GETCHR = $070250 OWRITE = $080260 PUTREC = $090270 APPEND = $090280 PUTCHR = $0B0290 CLOSE = $0C0300 OU6w}PDATE = $0C0310 STATUS = $0D0320 RENAME = $200330 DELETE = $210340 DFRMAT = $21 ;RESIDENT DISK HANDLER (RDH)0350 LOCK6x} = $230360 UNLOCK = $240370 POINT = $250380 NOTE = $260390 PTSECT = $50 ;RDH0400 GTSECT = $52 ; |0410 DSTAT = $6y}53 ; |0420 PSECTV = $57 ;RDH0430 NOIRG = $800440 EOL = $9B0450 ;0460 ;OS VARIABLES0470 ;0480 ;PAGE 00490 ;06z}500 CASINI = $020510 WARMST = $080520 DOSVEC = $0A0530 DOSINI = $0C0540 APPMHI = $0E ;DIS LOW LIMIT,20550 POKMSK = $16{}0 ;IRQ ENABLE FLAGS0560 BRKKEY = $11 ;FLAG0570 RTCLOK = $12 ;,3 +2=LSB0580 ZIOCB = $20 ;ZERO PAGE IOCB0590 6|}SOUNDR = $41 ;0=QUIET I/O0600 CRITIC = $42 ;NO VVBLKD FLAG0610 DSTAT = $4C ;DISPLAY STATUS0620 ATRACT = $4D06306}} LMARGN = $520640 RMARGN = $530650 ROWCRS = $540660 COLCRS = $550670 DINDEX = $57 ;DISPLAY MODE0680 SAVMSC = $58 ;6~}SCREEN ADR0690 OLDROW = $5A ;BEFORE DRAW/FILL0700 OLDCOL = $5B ;SCREEN ADR0710 OLDADR = $5E ;CURSOR ADDRESS0720 6}PALNTS = $62 ;PAL/NTSB FLAG0730 RAMTOP = $6A ;END OF DIS +10740 ZROFRE = $80 ;USER ZERO PAGE0750 ;TO - $D30766}0 ;FP - $D4 ;FREE IF NO0770 ;TO - $FF ;FLOATING POINT0780 ;0790 ;PAGE 1 STACK0800 ;0810 ;PAGE 20820 ;08306} VDSLST = $0200 ;NMI VECTOR0840 VBREAK = $02060850 VKEYBD = $02080860 VVBLKI = $02220870 VVBLKD = $02240880 SDMCTL = $06}22F0890 SDLSTL = $02300900 LPENH = $0234 ;LIGHT PEN0910 LPENV = $02350920 DFLAGS = $0240 ;DISK FLAG BYTE0930 PADDL0 =6} $02700940 GPRIOR = $026F0950 GTIA = $026F0960 STICK0 = $02780970 STRIG0 = $02840980 TXTROW = $02900990 TXTMSC = $02946}1000 TXTCOL = $02911010 INVFLG = $02B61020 SHFLOC = $02BE1030 BOTSCR = $02BF1040 PCOLR0 = $02C01050 COLOR0 = $02C410606} RAMSIZ = $02E4 ;START OF ROM1070 KRPDER = $02D9 ;REPEAT DELAY1080 KEYREP = $02DA ;REPEAT RATE1090 NOCLIK = $02DB ;CLI6}CK DISABLE1100 HELPFG = $02DC ;HELP KEY FLAG1110 GLBABS = $02E0 ;GLOBAL VARIABLES1120 RUNADR = $02E0 ;DISK RUN POINTER6}1130 INIADR = $02E2 ;DISK INIT POINT1140 RAMSIZ = $02E4 ;START OF ROM1150 MEMTOP = $02E5 ;END OF FREE RAM1160 MEMLO = $6}02E71170 CRSINH = $02F01180 KEYDEL = $02F1 ;KEY DELAY & RATE1190 CHACT = $02F31200 CHBAS = $02F41210 ATACHR = $02FB1226}0 CH = $02FC1230 FILDAT = $02FC1240 DSPFLG = $02FE1250 SSFLAG = $02FF1260 ;1270 ;PAGE 31280 ;1290 ;RESIDENT DISK HA6}NDLER & SIO INTERFACE1300 ;1310 DDEVIC = $03001320 DUNIT = $03011330 DCOMND = $03021340 DSTATS = $03031350 DBUFLO = $036}041360 DBUFHI = $03051370 DTIMLO = $03061380 DBYTLO = $03081390 DBYTHI = $03091400 DAUX1 = $030A1410 DAUX2 = $030B14206} ;1430 ;IOCB's1440 ;1450 ICHID = $03401460 ICDNO = $03411470 ICCOM = $03421480 ICSTA = $03431490 ICBAL = $03441500 IC6}BAH = $03451510 ICPTL = $03461520 ICPTH = $03471530 ICBLL = $03481540 ICBLH = $03491550 ICAX1 = $034A1560 ICAX2 = $034B6}1570 ICAX3 = $034C1580 ICAX4 = $034D1590 ICAX5 = $034E1600 ICAX6 = $034F1610 ;TO - $03BF ;OTHER IOCB's1620 PRNBUF =6} $03C01630 ;TO - $O3E71640 ;SPARE - $03E81650 ;TO - $03FC1660 CASBUF = $03FD ;CASSETTE BUFFER1670 ;1680 ;PAGE 46}1690 ;1700 ;TO - $047F ;CASBUF CONT.1710 USAREA = $0480 ;FREE1720 ;TO - $04FF1730 ;1740 ;PAGE 51750 ;1760 PAGE6}5 = $0500 ;FREE1770 ;TO - $057D1780 ;FP ONLY $057E ;FREE IF NO1790 ;TO - $05FF ;FLOATING POINT1800 ;1810 ;PAGE6} 61820 ;1830 PAGE6 = $0600 ;FREE1840 ;TO - $06FF1850 ;1860 ;PAGE 71870 ;1880 BOOTRG = $0700 ;PROGRAM AREA1890 ;6}1900 ;1910 ;UPPER ADDRESSES1920 ;1930 ;1940 RITCAR = $8000 ;RAM IF NO1950 LFTCAR = $A000 ;CARTRIDGE1960 C0PAGE = $C006}0 ;EMPTY IN 8001970 ;TO - $CFFF1980 ;1990 ;HARDWARE REGISTERS2000 ;2010 HPOSP0 = $D0002020 M0PF = $D0002030 SIZEP6}0 = $D0082040 M0PL = $D0082050 SIZEM = $D00C2060 GRAFP0 = $D00D2070 GRAFM = $D0112080 COLPM0 = $D0122090 COLPF0 = $D016}62100 PRIOR = $D01B2110 GTIAR = $D01B2120 VDELAY = $D01C2130 GRACTL = $D01D2140 HITCLR = $D01E2150 CONSOL = $D01F2160 6}AUDF1 = $D2002170 AUDC1 = $D2012180 AUDCTL = $D2082190 RANDOM = $D20A2200 IRQEN = $D20E2210 SKCTL = $D20F2220 PORTA = $6}D3002230 PORTB = $D3012240 PACTL = $D3022250 PBCTL = $D3032260 DLISTL = $D4022270 HSCROL = $D4042280 VSCROL = $D4052296}0 CHBASE = $D4092300 WSYNC = $D40A2310 VCOUNT = $D40B2320 NMIEN = $D40E2330 ;2340 ;FLOATING POINT MATH ROUTINES2350 ;26}360 AFP = $D8002370 FASC = $D8E62380 IFP = $D9AA2390 FPI = $D9D22400 ZFR0 = $DA442410 ZF1 = $DA462420 FSUB = 6} $DA602430 FADD = $DA662440 FMUL = $DADB2450 FDIV = $DB282460 PLYEVL = $DD402470 FLD0R = $DD892480 FLD0P = $DD8D2496}0 FLD1R = $DD982500 FLD1P = $DD9C2510 FSTOR = $DDA72520 FSTOP = $DDAB2530 FMOVE = $DDB62540 EXP = $DDC02550 EXP10 = $6}DDCC2560 LOG = $DECD2570 LOG10 = $DED12580 ;2590 ;2600 ;OPERATING SYSTEM2610 ;2620 ;2630 CHORG = $E000 ;CHARACTER6} SET2640 ;TO - $E3FF2650 ;2660 ;ROM VECTORS2670 ;2680 DSKINV = $E4532690 CIOV = $E4562700 SIOV = $E4592710 SYSVBV6} = $E45F2720 VBIVAL = $E460 ;ADR AT VVBLKI2730 XITVBV = $E4622740 VBIXVL = $E463 ;ADR AT VVBLKD2750 BLKBDV = $E47127606} WARMSV = $E4742770 COLDSV = $E4772780 ;2790 ;2800 ;GENERAL PROGRAM EQUATES2810 ;2820 COLOR = $C8 ;USED BY BASIC286}30 FROM = $CB2840 TO = $CD2850 ZPBYTE = $CF2860 ZPWORD = $D02870 TEMP = $04802820 COLOR = $C8 ;USED BY BASIC284W008063 NUMERICAL ORDERRegisters sharing addresses are listed first when writen to, then when read from. :} Register Shadow :} Name Description Address Name Address -----------------------------------------:}----------------------------- HPOSP0 horizontal position of player 0 $D000 53248 M0PF missile 0 to gr:}aphics collisions $D000 53248 HPOSP1 horizontal position of player 1 $D001 53249 M1P:}F missile 1 to graphics collisions $D001 53249 HPOSP2 horizontal position of player 2 $D002 53250 :} M2PF missile 2 to graphics collisions $D002 53250 HPOSP3 horizontal position of player :}3 $D003 53251 M3PF missile 3 to graphics collisions $D003 53251 HPOSM0 horizontal :}position of missile 0 $D004 53252 P0PF player 0 to graphics collisions $D004 53252 :}HPOSM1 horizontal position of missile 1 $D005 53253 P1PF player 1 to graphics collisions $D005 5325:}3 HPOSM2 horizontal position of missile 2 $D006 53254 P2PF player 2 to graphics colli:}sions $D006 53254 HOPSM3 horizontal position of missile 3 $D007 53255 P3PF player :}3 to graphics collisions $D007 53255 SIZEP0 player 0 size $D008 53256 :} M0PL missile 0 to player collisions $D008 53256 SIZEP1 player 1 size $D009 :}53257 M1PL missile 1 to player collisions $D009 53257 SIZEP2 player 2 size :} $D00A 53258 M2PL missile 2 to player collisions $D00A 53258 SIZEP3 pla:}yer 3 size $D00B 53259 M3PL missile 3 to player collisions $D00B 53259 :} SIZEM missile size $D00C 53260 P0PL player 0 to player collisions $D0:}0C 53260 GRAFP0 player 0 graphics $D00D 53261 P1PL player 1 to player :}collisions $D00D 53261 GRAFP1 player 1 graphics $D00E 53262 P2PL :}player 2 to player collisions $D00E 53262 GRAFP2 player 2 graphics $D00F 53263 :} P3PL player 3 to player collisions $D00F 53263 GRAFP3 player 3 graphics :} $D010 53264 TRIG0 joystick trigger 0 $D010 53264 STRIG0 $0284 644 GRAFM missile graphic:}s $D011 53265 TRIG1 joystick trigger 1 $D011 53265 STRIG1 $0285 645 COL:}PM0 color/brightness, player/missile 0 $D012 53266 PCOLR0 $02C0 704 TRIG2 joystick trigger 2 $D012 53266 ST:}RIG2 $0286 646 COLPM1 color/brightness, player/missile 1 $D013 53267 PCOLR1 $02C1 705 TRIG3 joystick trigger 3 :} $D013 53267 STRIG3 $0287 647 COLPM2 color/brightness, player/missile 2 $D014 53268 PCOLR2 $02C2 706 PAL Europe/Nort:}h America TV indicator $D014 53268 COLPM3 color/brightness, player/missile 3 $D015 53269 PCOLR3 $02C3 707 :}COLPF0 Color/brightness of setcolor 0 $D016 53270 COLOR0 $02C4 708 COLPF1 color/brightness of setcolor 1 $D017 5327:}1 COLOR1 $02C5 709 COLPF2 color/brightness of setcolor 2 $D018 53272 COLOR2 $02C6 710 COLPF3 color/brightness of setcol:}or 3 $D019 53273 COLOR3 $02C7 711 COLBK color/brightness of setcolor 4 $D01A 53274 COLOR4 $02C8 712 VDELAY vertica:}l delay $D01C 54276 GRACTL graphics control $D01D 53277 :} HITCLR clear collisions $D01E 54278 CONSOL [START], [SELECT], [OPT.], speaker $D01F :}53279 AUDF1 Audio frequency 1 control $D200 53760 POT0 game paddle 0 :} $D200 53760 PADDL0 $0270 624 AUDC1 Audio channel 1 control $D201 53761 POT1 gam:}e paddle 1 $D201 53761 PADDL1 $0271 625 AUDF2 Audio frequency 2 control $D202 53762 :} POT2 game paddle 2 $D202 53762 PADDL2 $0272 626 AUDC2 Audio channel 2 control $D:}203 53763 POT3 game paddle 3 $D203 53763 PADDL3 $0273 627 AUDF3 Audio frequency 3 :}control $D204 53764 POT4 game paddle 4 $D204 53764 PADDL4 $0274 628 AUDC3 :} Audio channel 3 control $D205 53765 POT5 game paddle 5 $D205 53765 PADDL:}5 $0275 629 AUDF4 Audio frequency 4 control $D206 53766 POT6 game paddle 6 :} $D206 53766 PADDL6 $0276 630 AUDC4 Audio channel 1 control $D207 53767 POT7 game paddle 7 :} $D207 53767 PADDL7 $0277 631 ALLPOT game paddle ready indicators $D208 53768 AU:}DCTL general audio control $D208 53768 KBCODE keyboard code $D209 53769 C:}H $O2FC 764 STIMER start timer $D209 53769 RANDOM random number generator :} $D20A 53770 SKREST reset serial port status $D20A 53770 POTGO start pot :}scan sequence $D20B 53771 SEROUT serial port output $D20D 53773 :} SERIN serial port input $D20D 53774 IRQEN interrupt request enable (IRQ) $D20E 537:}74 POKMSK $0010 16 IRQST IRQ status $D20E 53774 SKCTL serial port control :} $D20F 53775 SSKCTL $0232 563 SKSTAT serial port status $D20F 53775 PRIOR p/m pr:}iority and GTIA mode $D21B 53275 GPRIOR $026F 623 PORTA port A $D300 54016 STICK0 $0278:} 632 STICK1 $0279 633 PORTB port B $D301:} 54017 STICK2 $027A 634 STICK3 $027B 635 PACTL port A control :} $D302 54018 PBCTL port B control $D303 54019 DMACTL Di:}rect Memory access control (DMA) $D400 54272 SDMCTL $022F 559 CHACTL character control $D401 54273 CHART $:}02F3 755 DLISTL display list pointer low byte $D402 54274 SDLSTL $0230 560 DLISTH display list pointer high byte $:}D403 54275 SDLSTH $0231 561 HSCROL horizontal scroll $D404 54276 VSCROL vertical scroll :} $D405 54277 PMBASE player/missile address / 256 $D407 54279 CHBAS:}E Address of character set / 256 $D409 54281 CHBAS $O2F4 756 WSYNC wait for horizontal sync $D40A 54282 :} VCOUNT vertical line counter $D40B 54283 PENH light pen horizontal position :} $D40C 54284 LPENH $0234 564 PENV light pen vertical position $D40D 54285 LPENV $0235 565 NMIEN non-maskable :}interrupt enable (NMI)$D40E 54286 NMIRES NMI reset $D40F 54287 N:}MIST NMI status $D40F 54287 $D40F 54287 N8E008063 APPENDIX A. HARDWARE REGISTERS Register Shadow >} Name Description Address N>}ame Address ---------------------------------------------------------------------- ALLPOT game paddle ready indicators >} $D208 53768 AUDC1 Audio channel 1 control $D201 53761 AUDC2 Audio chan>}nel 2 control $D203 53763 AUDC3 Audio channel 3 control $D205 53765 >} AUDC4 Audio channel 1 control $D207 53767 AUDCTL general audio control $D208 537>}68 AUDF1 Audio frequency 1 control $D200 53760 AUDF2 Audio frequency 2 control>} $D202 53762 AUDF3 Audio frequency 3 control $D204 53764 AUDF4 Audio >}frequency 4 control $D206 53766 CHACTL character control $D401 54273 CHART $02F3>} 755 CHBASE Address of character set / 256 $D409 54281 CHBAS $O2F4 756 COLBK color/brightness of setcolor 4 $D01A>} 53274 COLOR4 $02C8 712 COLPF0 Color/brightness of setcolor 0 $D016 53270 COLOR0 $02C4 708 COLPF1 color/brightness of s>}etcolor 1 $D017 53271 COLOR1 $02C5 709 COLPF2 color/brightness of setcolor 2 $DO18 53272 COLOR2 $02C6 710 COLPF3 co>}lor/brightness of setcolor 3 $DO19 53273 COLOR3 $02C7 711 COLPM0 color/brightness, player/missile 0 $D012 53266 PCOLR0 $>}02C0 704 COLPM1 color/brightness, player/missile 1 $DO13 53267 PCOLR1 $02C1 705 COLPM2 color/brightness, player/missile 2 $>}DO14 53268 PCOLR2 $02C2 706 COLPM3 color/brightness, player/missile 3 $DO15 53269 PCOLR3 $02C3 707 CONSOL [START], [SELECT]>}, [OPT.], speaker $D01F 53279 DLISTH display list pointer high byte $D403 54275 SDLSTH $0231 561 DLIST>}L display list pointer low byte $D402 54274 SDLSTL $0230 560 DMACTL Direct Memory access control (DMA) $D400 54272 SDMC>}TL $022F 559 GRACTL graphics control $D01D 53277 GRAFM missile graphics >} $D011 53265 GRAFP0 player 0 graphics $D00D 53261 GRAFP1 player 1 grap>}hics $D00E 53262 GRAFP2 player 2 graphics $D00F 53263 G>}RAFP3 player 3 graphics $D010 53264 HITCLR clear collisions $D01E 54278 >} HPOSM0 horizontal position of missile 0 $D004 53252 HPOSM1 horizontal position of missi>}le 1 $D005 53253 HPOSM2 horizontal position of missile 2 $D006 53254 HOPSM3 horizonta>}l position of missile 3 $D007 53255 HPOSP0 horizontal position of player 0 $D000 53248 >} HPOSP1 horizontal position of player 1 $D001 53249 HPOSP2 horizontal position of player 2 $D002 53>}250 HPOSP3 horizontal position of player 3 $D003 53251 HSCROL horizontal scroll >} $D404 54276 IRQEN interrupt request enable (IRQ) $D20E 53774 POKMSK $0010 16 IRQST IRQ s>}tatus $D20E 53774 KBCODE keyboard code $D209 53769 CH $O2F>}C 764 M0PF missile 0 to graphics collisions $D000 53248 M0PL missile 0 to player collisions $D00>}8 53256 M1PF missile 1 to graphics collisions $D001 53249 M1PL missile 1 to player ?}collisions $D009 53257 M2PF missile 2 to graphics collisions $D002 53250 M2PL m?}issile 2 to player collisions $D00A 53258 M3PF missile 3 to graphics collisions $D003 53251 ?} M3PL missile 3 to player collisions $D00B 53259 NMIEN non-maskable interrupt enable (NMI)?}$D40E 54286 NMIRES NMI reset $D40F 54287 NMIST NMI status ?} $D40F 54287 P0PF player 0 to graphics collisions $D004 53252 P0PL?} player 0 to player collisions $D00C 53260 P1PF player 1 to graphics collisions $D005 53253 ?} P1PL player 1 to player collisions $D00D 53261 P2PF player 2 to graphics collisions?} $D006 53254 P2PL player 2 to player collisions $D00E 53262 P3PF player 3 to ?}graphics collisions $DOO7 53255 P3PL player 3 to player collisions $D00F 53263 ? }PACTL port A control $D302 54018 PAL Europe/North America TV indicator $D014 53268? } PBCLT port B control $D303 54019 PENH light pen horizontal positio? }n $D40C 54284 LPENH $0234 564 PENV light pen vertical position $D40D 54285 LPENV $0235 565 PMBASE player/mi? }ssile address / 256 $D407 54279 PORTA port A $D300 54016 STICK0 $0278 63? }2 STICK1 $0279 634 PORTB port B $D301 54?}017 STICK2 $027A 634 STICK3 $027B 635 POT0 game paddle 0 ?} $D200 53760 PADDL0 $0270 624 POT1 game paddle 1 $D201 53761 PADDL1 $0271 625 POT2 game ?}paddle 2 $D202 53762 PADDL2 $0272 626 POT3 game paddle 3 $D203 53763 PADDL3 $027?}3 627 POT4 game paddle 4 $D204 53764 PADDL4 $0274 628 POT5 game paddle 5 $D20?}5 53765 PADDL5 $0275 629 POT6 game paddle 6 $D206 53766 PADDL6 $0276 630 POT7 game paddle 7 ?} $D207 53767 PADDL7 $0277 631 POTGO start pot scan sequence $D20B 53771 PRIOR p?}/m priority and GTIA mode $D21B 53275 GPRIOR $026F 623 RANDOM random number generator $D20A 53770 ?} SERIN serial port input $D20D 53774 SEROUT serial port output ?}$D20D 53773 SIZEM missile size $D00C 53260 SIZEP0 player 0 size ?} $D008 53256 SIZEP1 player 1 size $D009 53257 SIZE?}P2 player 2 size $D00A 53258 SIZEP3 player 3 size $D00B 53259 ?} SKCTL serial port control $D20F 53775 SSKCTL $0232 563 SKREST reset serial port status ?} $D20A 53770 SKSTAT serial port status $D20F 53775 STIMER start timer ?} $D209 53769 TRIG0 joystick trigger 0 $D010 53264 STRIG0 $0284 644 ?}TRIG1 joystick trigger 1 $D011 53265 STRIG1 $0285 645 TRIG2 joystick trigger 2 $D012 53266?} STRIG2 $0286 646 TRIG3 joystick trigger 3 $D013 53267 STRIG3 $0287 647 VCOUNT vertical line counter ?} $D40B 54283 VDELAY vertical delay $D01C 54276 VSCROL vertical?} scroll $D405 54277 WSYNC wait for horizontal sync $D40A 54282 ? } scroll $D405 54277 WSYNC wait for horizontal sync $D40A 54282 <008063 SHADOW REGISTER ORDERALPHABETICAL ORDER Register Shadow C"} Name Description C#}Address Name Address ---------------------------------------------------------------------- KBCODE keyboard code C$} $D209 53769 CH $O2FC 764 CHACTL character control $D401 54273 CHART $02F3 755 CHBASE AC%}ddress of character set / 256 $D409 54281 CHBAS $O2F4 756 COLBK color/brightness of setcolor 4 $D01A 53274 COLOR4 C&}$02C8 712 COLPF0 Color/brightness of setcolor 0 $D016 53270 COLOR0 $02C4 708 COLPF1 color/brightness of setcolor 1 C'}$D017 53271 COLOR1 $02C5 709 COLPF2 color/brightness of setcolor 2 $D018 53272 COLOR2 $02C6 710 COLPF3 color/brightnessC(} of setcolor 3 $D019 53273 COLOR3 $02C7 711 PRIOR p/m priority and GTIA mode $D21B 53275 GPRIOR $026F 623 PENHC)} light pen horizontal position $D40C 54284 LPENH $0234 564 PENV light pen vertical position $D40D 54285 LPEC*}NV $0235 565 POT0 game paddle 0 $D200 53760 PADDL0 $0270 624 POT1 game paddle 1 C+} $D201 53761 PADDL1 $0271 625 POT2 game paddle 2 $D202 53762 PADDL2 $0272 626 POT3 game paddle C,}3 $D203 53763 PADDL3 $0273 627 POT4 game paddle 4 $D204 53764 PADDL4 $0274 628 C-}POT5 game paddle 5 $D205 53765 PADDL5 $0275 629 POT6 game paddle 6 $D206 53766C.} PADDL6 $0276 630 POT7 game paddle 7 $D207 53767 PADDL7 $0277 631 COLPM0 color/brightness, player/miC/}ssile 0 $D012 53266 PCOLR0 $02C0 704 COLPM1 color/brightness, player/missile 1 $D013 53267 PCOLR1 $02C1 705 COLPM2 color/brC0}ightness, player/missile 2 $D014 53268 PCOLR2 $02C2 706 COLPM3 color/brightness, player/missile 3 $D015 53269 PCOLR3 $02C3 7C1}07 IRQEN interrupt request enable (IRQ) $D20E 53774 POKMSK $0010 16 DLISTH display list pointer high byte $D403 5C2}4275 SDLSTH $0231 561 DLISTL display list pointer low byte $D402 54274 SDLSTL $0230 560 DMACTL Direct Memory access coC3}ntrol (DMA) $D400 54272 SDMCTL $022F 559 SKCTL serial port control $D20F 53775 SSKCTL $0232 563 PORTA portC4} A $D300 54016 STICK0 $0278 632 STICK1 $02C5}79 633 PORTB port B $D301 54017 STICK2 $027A 634 C6} STICK3 $027B 635 TRIG0 joystick trigger 0 $D010 53264 STRIG0 $0284 644 TRIG1 joystick trigger 1 C7} $D011 53265 STRIG1 $0285 645 TRIG2 joystick trigger 2 $D012 53266 STRIG2 $0286 646 TRIG3 C8}joystick trigger 3 $D013 53267 STRIG3 $0287 647 NUMERICAL ORDERIRQEN interrupt request enable (IRQ) $C9}D20E 53774 POKMSK $0010 16 DMACTL Direct Memory access control (DMA) $D400 54272 SDMCTL $022F 559 DLISTL display list poinC:}ter low byte $D402 54274 SDLSTL $0230 560 DLISTH display list pointer high byte $D403 54275 SDLSTH $0231 561 SKCTLC;} serial port control $D20F 53775 SSKCTL $0232 563 PENH light pen horizontal position $D40C 54284 LPENC<}H $0234 564 PENV light pen vertical position $D40D 54285 LPENV $0235 565 PRIOR p/m priority and GTIA mode C=} $D21B 53275 GPRIOR $026F 623 POT0 game paddle 0 $D200 53760 PADDL0 $0270 624 POT1 game paddle 1C>} $D201 53761 PADDL1 $0271 625 POT2 game paddle 2 $D202 53762 PADDL2 $0272 626 PC?}OT3 game paddle 3 $D203 53763 PADDL3 $0273 627 POT4 game paddle 4 $D204 53764 C@}PADDL4 $0274 628 POT5 game paddle 5 $D205 53765 PADDL5 $0275 629 POT6 game paddle 6 CA} $D206 53766 PADDL6 $0276 630 POT7 game paddle 7 $D207 53767 PADDL7 $0277 631 PORTA port A CB} $D300 54016 STICK0 $0278 632 STICK1 $0279 63CC}3 PORTB port B $D301 54017 STICK2 $027A 634 CD} STICK3 $027B 635 TRIG0 joystick trigger 0 $D010 53264 STRIG0 $0284 644 TRIG1 joystick trigger 1 CE} $D011 53265 STRIG1 $0285 645 TRIG2 joystick trigger 2 $D012 53266 STRIG2 $0286 646 TRIG3 joystCF}ick trigger 3 $D013 53267 STRIG3 $0287 647 COLPM0 color/brightness, player/missile 0 $D012 53266 PCOLR0 $02CCG}0 704 COLPM1 color/brightness, player/missile 1 $D013 53267 PCOLR1 $02C1 705 COLPM2 color/brightness, player/missile 2 $D01CH}4 53268 PCOLR2 $02C2 706 COLPM3 color/brightness, player/missile 3 $D015 53269 PCOLR3 $02C3 707 COLPF0 Color/brightness of CI}setcolor 0 $D016 53270 COLOR0 $02C4 708 COLPF1 color/brightness of setcolor 1 $D017 53271 COLOR1 $02C5 709 COLPF2 cCJ}olor/brightness of setcolor 2 $D018 53272 COLOR2 $02C6 710 COLPF3 color/brightness of setcolor 3 $D019 53273 COLOR3 CK}$02C7 711 COLBK color/brightness of setcolor 4 $D01A 53274 COLOR4 $02C8 712 CHACTL character control CL}$D401 54273 CHART $02F3 755 CHBASE Address of character set / 256 $D409 54281 CHBAS $O2F4 756 KBCODE keyboard code CM} $D209 53769 CH $O2FC 764 character set / 256 $D409 54281 CHBAS $O2F4 756 KBCODE keyboard code @0008063 APPENDIX B.OPERATING SYSTEM EQUATES0100 ;0101 ; ATARI 800 EQUATE LISTING0102 ;010GO}3 ;0104 ;0105 ;This listing is based on the original release of Operating System, 0106 ;version A. The vectors shown here wGP}ere not changed in version B. 0107 ;New equates for XL and XE models are included and noted. Changes 0108 ;from version B to GQ}XL/XE are also noted.0109 ; 0110 ;Most of the equate names given below are the official Atari 0111 ;names. They are in commonGR} use but are not mandatory.0112 ;0113 ;0114 ; DEVICE NAMES0115 ;0116 ;0117 ;SCREDT = "E" SCREEN EDITOR0118 ;KBGS}D = "K" KEYBOARD0119 ;DISPLY = "S" DISPLAY0120 ;PRINTR = "P" PRINTER0121 ;CASSET = "C" CASSETTE0122 ;DISK = GT}"D" DISK DRIVE0123 ;0124 ;0125 ;0126 ; STATUS CODES 0127 ;0128 ;0129 SUCCES = $01 10130 BRKABT = $80GU} 128 BREAK KEY ABORT0131 PRVOPN = $82 130 IOCB ALREADY OPEN0132 NONDEV = $82 130 NONEXISTANT DEVICE0133 WROGV}NLY = $83 131 OPENED FOR WRITE ONLY0134 NVALID = $84 132 INVALID COMMAND0135 NOTOPN = $85 133 DEVICE OR FILEGW} NOT OPEN0136 BADIOC = $86 134 INVALID IOCB NUMBER0137 RDONLY = $87 135 OPENED FOR READ ONLY0138 EOFERR = $88 GX} 136 END OF FILE0139 TRNRCD = $89 137 TRUNCATED RECORD0140 TIMOUT = $8A 138 PERIPHERAL TIME OUT0141 DNACK = $GY}8B 139 DEVICE DOES NOT ACKNOWLEDGE0142 FRMERR = $8C 140 SERIAL BUS FRAMING ERROR0143 CRSROR = $8D 141 CURSORGZ} OUT OF RANGE0144 OVRRUN = $8E 142 SERIAL BUS DATA OVERRUN0145 CHKERR = $8F 143 SERIAL BUS CHECKSUM ERROR0146 DEG[}RROR = $90 144 PERIPHERAL DEVICE ERROR0147 BADMOD = $91 145 NON EXISTANT SCREEN MODE0148 FNCNOT = $92 146 FUG\}NCTION NOT IMPLEMENTED0149 SCRMEM = $93 147 NOT ENOUGH MEMORY FOR SCREEN MODE0150 ;0151 ;0152 ;0153 ;0154 ; COMMAG]}ND CODES FOR CIO0155 ;0156 ;0157 OPEN = $03 30158 OPREAD = $04 4 OPEN FOR INPUT0159 GETREC = $05 G^}5 GET RECORD0160 OPDIR = $06 6 OPEN TO DISK DIRECTORY0161 GETCHR = $07 7 GET BYTE0162 OWRITE = $08 8G_} OPEN FOR OUTPUT0163 PUTREC = $09 9 WRITE RECORD0164 APPEND = $09 9 OPEN TO APPEND TO END OF DISK FILE0165 MG`}XDMOD = $10 16 OPEN TO SPLIT SCREEN (MIXED MODE)0166 PUTCHR = $0B 11 PUT-BYTE0167 CLOSE = $0C 120168 OUGa}PDAT = $0C 12 OPEN FOR INPUT AND OUTPUT AT THE SAME TIME0169 STATUS = $0D 130170 SPECIL = $0E 14 BEGINNINGb}G OF SPECIAL COMMANDS0171 DRAWLN = $11 17 SCREEN DRAW0172 FILLIN = $12 18 SCREEN FILL0173 RENAME = $20 3Gc}20174 INSCLR = $20 32 OPEN TO SCREEN BUT DON'T ERASE0175 DELETE = $21 330176 DFRMAT = $21 33 FORMAT DISKGd} (RESIDENT DISK HANDLER (RDH))0177 LOCK = $23 350178 UNLOCK = $24 360179 POINT = $25 370180 NOTE =Ge} $26 380181 PTSECT = $50 80 RDH PUT SECTOR0182 GTSECT = $52 82 RDH GET SECTOR0183 DSTAT = $53 83 Gf}RDH GET STATUS0184 PSECTV = $57 87 RDH PUT SECTOR AND VERIFY0185 NOIRG = $80 128 NO GAP CASSETTE MODE0186 CR Gg} = $9B 155 CARRIAGE RETURN (EOL)0187 ;0188 IOCBSZ = $10 16 IOCB SIZE0189 MAXIOC = $80 128 MAX IOCB BLOCKGh} SIZE0190 IOCBF = $FF 255 IOCB FREE0191 ;0192 LEDGE = $02 2 DEFAULT LEFT MARGIN0193 REDGE = $27 39 DGi}EFAULT RIGHT MARGIN0194 ;0195 ; OS VARIABLES0196 ;0197 ; PAGE 00198 ;0199 LINZBS = $00 0 (800) FOGj}R ORIGINAL DEBUGGER0200 ; $00 0 (XL) RESERVED0201 NGFLAG = $01 1 (XL) FOR POWER-UP SELF TEST0202 CASIGk}NI = $02 20203 RAMLO = $04 4 POINTER FOR SELF TEST0204 TRAMSZ = $06 6 TEMPORARY RAM SIZE0205 TSTDAT Gl}= $07 7 TEST DATA0206 WARMST = $08 80207 BOOT? = $09 9 SUCCESSFUL BOOT FLAG0208 DOSVEC = $0A 1Gm}0 PROGRAM RUN VECTOR0209 DOSINI = $0C 12 PROGRAM INITIALIZATION0210 APPMHI = $0E 14 DISPLAY LOW LIMIT0211 POKMGn}SK = $10 16 IRQ ENABLE FLAGS0212 BRKKEY = $11 17 FLAG0213 RTCLOK = $12 18 3 BYTES, MSB FIRST0214 BUFADR Go}= $15 21 INDIRECT BUFFER ADDRESS0215 ICCOMT = $17 23 COMMAND FOR VECTOR0216 DSKFMS = $18 24 DISK FILE MANGp}AGER POINTER0217 DSKUTL = $1A 26 DISK UTILITY POINTER (DUP.SYS)0218 PTIMOT = $1C 28 (800) PRINTER TIME OUT REGIGq}STER0219 ABUFPT = $1C 28 (XL) RESERVED0220 PBPNT = $1D 29 (800) PRINTER BUFFER POINTER0221 ; $1D Gr} 29 (XL) RESERVED0222 PBUFSZ = $1E 30 (800) PRINTER BUFFER SIZE0223 ; $1E 30 (XL) RESERVED0224 PTEMP =Gs} $1F 31 (800) TEMPORARY REGISTER0225 ; $1F 31 (XL) RESERVED0226 ZIOCB = $20 32 ZERO PAGE IOCB022Gt}7 ICHIDZ = $20 32 HANDLER INDEX NUMBER (ID)0228 ICDNOZ = $21 33 DEVICE NUMBER0229 ICCOMZ = $22 34 COMMANDGu}0230 ICSTAZ = $23 35 STATUS0231 ICBALZ = $24 36 BUFFER POINTER LOW BYTE0232 ICBAHZ = $25 37 BUFFER POINTGv}ER HIGH BYTE0233 ICPTLZ = $26 38 PUT ROUTINE POINTER LOW0234 ICPTHZ = $27 39 PUT ROUTINE POINTER HIGH0235 ICBLGw}LZ = $28 40 BUFFER LENGTH LOW0236 ICBLHZ = $29 410237 ICAX1Z = $2A 42 AUXILIARY INFORMATION BYTE 10238 IGx}CAX2Z = $2B 430239 ICSPRZ = $2C 44 TWO SPARE BYTES (CIO USE)0240 ICIDNO = $2E 46 IOCB NUMBER X 160241 CIGy}OCHR = $2F 47 CHARACTER BYTE FOR CURRENT OPERATION0242 ;0243 STATUS = $30 48 STATUS STORAGE0244 CHKSUM = $31 Gz} 49 SUM WITH CARRY ADDED BACK0245 BUFRLO = $32 50 DATA BUFFER LOW BYTE0246 BUFRHI = $33 510247 BFENLO = $3G{}4 52 ADDRESS OF LAST BUFFER BYTE +1 (LOW)0248 BFENHI = $35 530249 CRETRY = $36 54 (800) NUMBER OF COMMANDG|} FRAME RETRIES0250 LTEMP = $36 54 (XL) LOADER TEMPORARY STORAGE, 2 BYTES0251 DRETRY = $37 55 (800) DEVICE RETRG}}IES0252 BUFRFL = $38 56 BUFFER FULL FLAG0253 RECVDN = $39 57 RECEIVE DONE FLAG0254 XMTDON = $3A 58 TRANSG~}MISSION DONE FLAG0255 CHKSNT = $3B 59 CHECKSUM-SENT FLAG0256 NOCKSM = $3C 60 CHECKSUM-DOES-NOT-FOLLOW-DATA FLAGG}0257 BPTR = $3D 610258 FTYPE = $3E 620259 FEOF = $3F 630260 FREQ = $40 640261 ;0262 SOUNG}DR = $41 65 0=QUIET I/O0263 CRITIC = $42 66 CRITICAL FUNCTION FLAG, NO DEFFERED VBI0264 FMSZPG = $43 67 DG}OS ZERO PAGE, 7 BYTES0265 CKEY = $4A 74 (800) START KEY FLAG0266 ZCHAIN = $4A 74 (XL) HANDLER LOADER TEMP, 2 G}BYTES0267 CASSBT = $4B 75 (800) CASSETTE BOOT FLAG0268 DSTAT = $4C 76 DISPLAY STATUS0269 ;0270 ATRACT = $4D G} 770271 DRKMSK = $4E 78 ATTRACT MASK0272 COLRSH = $4F 79 ATTRACT COLOR SHIFTER (EORed WITH GRAPHICS)0273 G};0274 TMPCHR = $50 800275 HOLD1 = $51 810276 LMARGN = $52 82 SCREEN LEFT MARGIN REGISTER0277 RMARGN = G}$53 83 SCREEN RIGHT MARGIN0278 ROWCRS = $54 84 CURSOR ROW0279 COLCRS = $55 85 CURSOR COLUMN, 2 BYTES0280G} DINDEX = $57 87 DISPLAY MODE0281 SAVMSC = $58 88 SCREEN ADDRESS0282 OLDROW = $5A 90 CURSOR BEFORE DRAW OG}R FILL0283 OLDCOL = $5B 910284 OLDCHR = $5D 93 DATA UNDER CURSOR0285 OLDADR = $5E 94 CURSOR ADDRESS0286G} NEWROW = $60 96 (800) DRAWTO DESTINATION0287 FKDEF = $60 96 (XL) FUNCTION KEY DEFINATION POINTER0288 NEWCOL =G} $61 97 (800) DRAWTO DESTINATION, 2 BYTES0289 PALNTS = $62 98 (XL) EUROPE/NORTH AMERICA TV FLAG0290 LOGCOL = $6G}3 99 LOGICAL LINE COLUMN POINTER0291 MLTTMP = $66 1020292 OPNTMP = $66 102 TEMPORARY STORAGE FOR CHANNEL OPG}EN0293 SAVADR = $68 1040294 RAMTOP = $6A 106 START OF ROM (END OF RAM + 1), HIGH BYTE ONLY0295 BUFCNT = $6B G} 107 BUFFER COUNT0296 BUFSTR = $6C 108 POINTER USED BY EDITOR0297 BITMSK = $6E 110 POINTER USED BY EDITOR0298 SHG}FAMT = $6F 1110299 ROWAC = $70 1120300 COLAC = $72 1140301 ENDPT = $74 1160302 DELTAR = $76 1G}180303 DELTAC = $77 1190304 ROWINC = $79 121 (800)0305 KEYDEF = $79 121 (XL) KEY DEFINATION POINTER, 2 BYTEG}S0306 COLINC = $7A 122 (800)0307 SWPFLG = $7B 123 NON 0 IF TEXT AND REGULAR RAM IS SWAPPED0308 HOLDCH = $7C G} 124 CH MOVED HERE BEFORE CTRL AND SHIFT0309 INSDAT = $7D 1250310 COUNTR = $7E 1260311 ;0312 ZROFRE = $80 G}128 FREE ZERO PAGE, 84 BYTES0313 FPZRO = $D4 212 FLOATING POINT RAM, 43 BYTES0314 FR0 = $D4 212 FP REGISTER 0G}0315 FRE = $DA 2180316 FR1 = $E0 224 FP REGISTER 10317 FR2 = $E6 230 FP REGISTER 20318 FRX = $G}EC 236 SPARE0319 EEXP = $ED 237 VALUE OF E0320 NSIGN = $ED 237 SIGN OF FP NUMBER0321 ESIGN = $EF 2G}39 SIGN OF FP EXPONENT0322 FCHFLG = $F0 240 FIRST CHARACTER FLAG0323 DIGRT = $F1 241 NUMBER OF DIGITS RIGHT OF DG}ECIMAL POINT0324 CIX = $F2 242 INPUT INDEX0325 INBUFF = $F3 243 POINTER TO ASCII FP NUMBER0326 ZTEMP1 = $F5 G} 2450327 ZTEMP4 = $F7 2470328 ZTEMP3 = $F9 2490329 DEGFLG = $FB 2510330 RADFLG = $FB 251 0=RADIANSG}, 6=DEGREES0331 FLPTR = $FC 252 POINTER TO BCD FP NUMBER0332 FPTR2 = $FE 2540333 ;0334 ;0335 ; PAGEG} 10336 ;0337 ; 65O2 STACK0338 ;0339 ;O BCD FP NUMBER0332 FPTR2 = $FE 2540333 ;0334 ;0335 ; PAGED00080630340 ;0341 ;0342 ; PAGE 20343 ;0344 ;0345 INTABS = $0200 512 INTERRUPT RAM0346 VDSLST = $02K}00 512 NMI VECTOR0347 VPRCED = $0202 514 PROCEED LINE IRQ VECTOR0348 VINTER = $0204 516 INTERRUPT LINE IRQ VECTORK}0349 VBREAK = $0206 5180350 VKEYBD = $0208 5200351 VSERIN = $020A 522 SERIAL INPUT READY IRQ0352 VSEROR = $020C K} 524 SERIAL OUTPUT READY IRQ0353 VSEROC = $020E 526 SERIAL OUTPUT COMPLETE IRQ0354 VTIMR1 = $0210 528 TIMER 1 IRQ03K}55 VTIMR2 = $0212 530 TIMER 2 IRQ0356 VTIMR4 = $0214 532 TIMER 4 IRQ0357 VIMIRQ = $0216 534 IRQ VECTOR0358 CDTMV1K} = $0218 536 DOWN TIMER 10359 CDTMV2 = $021A 538 DOWN TIMER 20360 CDTMV3 = $021C 540 DOWN TIMER 30361 CDTMV4 = $0K}21E 542 DOWN TIMER 40362 CDTMV5 = $0220 544 DOWN TIMER 50363 VVBLKI = $0222 5460364 VVBLKD = $0224 5480365 CDK}TMA1 = $0226 550 DOWN TIMER 1 JSR ADDRESS0366 CDTMA2 = $0228 552 DOWN TIMER 2 JSR ADDRESS0367 CDTMF3 = $022A 554 DK}OWN TIMER 3 FLAG0368 SRTIMR = $022B 555 REPEAT TIMER0369 CDTMF4 = $022C 556 DOWN TIMER 4 FLAG0370 INTEMP = $022D K}557 IAN'S TEMP0371 CDTMF5 = $022E 558 DOWN TIMER FLAG 50372 SDMCTL = $022F 559 DMACTL SHADOW0373 SDLSTL = $0230 5K}60 DISPLAY LIST POINTER0374 SSKCTL = $0232 562 SKCTL SHADOW0375 ; $0233 563 (800) UNLISTED0376 LCOUNT = $0233K} 563 (XL) LOADER TEMP0377 LPENH = $0234 564 LIGHT PEN HORIZONTAL0378 LPENV = $0235 565 LIGHT PEN VERTICAL0379 ;K} $0236 566 2 SPARE BYTES0380 ; $0238 568 (800) SPARE, 2 BYTES0381 RELADR = $0238 568 (XL) LOADER038K}2 CDEVIC = $023A 570 DEVICE COMMAND FRAME BUFFER0383 CAUX1 = $023C 572 DEVICE COMMAND AUX 10384 CAUX2 = $023D 57K}3 DEVICE COMMAND AUX 20385 TEMP = $023E 574 TEMPORARY STORAGE0386 ERRFLG = $023F 575 DEVICE ERROR FLAG (EXCEPT TIMEK}OUT)0387 DFLAGS = $0240 576 FLAGS FROM DISK SECTOR 10388 DBSECT = $0241 577 NUMBER OF BOOT DISK SECTORS0389 BOOTAD =K} $0242 578 BOOT LOAD ADDRESS POINTER0390 COLDST = $0244 580 COLD START FLAG, 1 = COLD START IN PROGRESS0391 ; K}$0245 581 (800) SPARE0392 RECLEN = $0245 581 (XL) LOADER0393 DSKTIM = $0246 582 (800) DISK TIME OUT REGISTER0394 K}; $0246 582 (XL) RESERVED, 39 BYTES0395 LINBUF = $0247 583 (800) CHARACTER LINE BUFFER, 40 BYTES0396 CHSALT = K}$026B 619 (XL) CHARACTER SET POINTER0397 VSFLAG = $026C 620 (XL) FINE SCROLL TEMPORARY0398 KEYDIS = $026D 621 (XL)K} KEYBOARD DISABLE0399 FINE = $026E 622 (XL) FINE SCROLL FLAG0400 GPRIOR = $026F 623 P/M PRIORITY AND GTIA MODES040K}1 GTIA = $026F 6230402 PADDL0 = $0270 624 (XL) 3 MORE PADDLES, (800) 6 MORE PADDLES0403 STICK0 = $0278 632 (XL) K}1 MORE STICK, (800) 3 MORE STICKS0404 PTRIG0 = $027C 636 (XL) 3 MORE PADDLE TRIGGERS, (800) 6 MORE0405 STRIG0 = $0284 K} 644 (XL) 1 MORE STICK TRIGGER, (800) 3 MORE0406 CSTAT = $0288 648 (800)0407 WMODE = $0289 6490408 BLIM = $028A K} 6500409 ; $028B 651 5 SPARE BYTES0410 NEWADR = $028E 654 (XL) LOADER RAM0411 TXTROW = $0290 6560412 TK}XTCOL = $0291 6570413 TINDEX = $0293 659 TEXT INDEX0414 TXTMSC = $0294 6600415 TXTOLD = $0296 662 OLD ROW AND K}OLD COL FOR TEXT, 2 BYTES0416 ; $0298 664 4 SPARE BYTES0417 TMPX1 = $029C 668 (800)0418 CRETRY = $029C 66K}8 (XL) NUMBER OF COMMAND FRAME RETRIES0419 SUBTMP = $029E 6700420 HOLD2 = $029F 6710421 DMASK = $02A0 6720422K} TMPLBT = $02A1 6730423 ESCFLG = $02A2 6740424 TABMAP = $02A3 675 15 BYTE BIT MAP FOR TAB SETTINGS0425 LOGMAP = $K}02B2 690 4 BYTE LOGICAL LINE START BIT MAP0426 INVFLG = $02B6 6940427 FILFLG = $02B7 695 FILL DIRING DRAW FLAG042K}8 TMPROW = $02B8 6960429 TMPCOL = $02B9 6970430 SCRFLG = $02BB 699 SCROLL FLAG0431 HOLD4 = $02BC 7000432 HOLK}D5 = $02BD 701 (800)0433 DRETRY = $02BD 701 (XL) NUMBER OF DEVICE RETRIES0434 SHFLOC = $02BE 7020435 BOTSCR = $K}02BF 703 24 NORM, 4 SPLIT0436 PCOLR0 = $02C0 704 3 MORE PLAYER COLOR REGISTERS0437 COLOR0 = $02C4 708 4 MORE GRAPHK}ICS COLOR REGISTERS0438 ; $02C9 713 (800) 23 SPARE BYTES0439 RUNADR = $02C9 713 (XL) LOADER VECTOR0440 HIUSEDK} = $02CB 715 (XL) LOADER VECTOR0441 ZHIUSE = $02CD 717 (XL) LOADER VECTOR0442 GBYTEA = $02CF 719 (XL) LOADER VECTOK}R0443 LOADAD = $02D1 721 (XL) LOADER VECTOR0444 ZLOADA = $02D3 723 (XL) LOADER VECTOR0445 DSCTLN = $02D5 725 (XL)K} DISK SECTOR SIZ0446 ACMISR = $02D7 727 (XL) RESERVED0447 KRPDER = $02D9 729 (XL) KEY AUTO REPEAT DELAY0448 KEYREP =K} $02DA 730 (XL) KEY AUTO REPEAT RATE0449 NOCLIK = $02DB 731 (XL) KEY CLICK DISABLE0450 HELPFG = $02DC 732 (XL) HELK}P KEY FLAG0451 DMASAV = $02DD 733 (XL) SDMCTL (DMA) SAVE0452 PBPNT = $02DE 734 (XL) PRINTER BUFFER POINTER0453 PBUFK}SZ = $02DF 735 (XL) PRINTER BUFFER SIZE0454 GLBABS = $02E0 736 GLOBAL VARIABLES, 4 SPARE BYTES0455 RAMSIZ = $02E4 K}740 PERMANENT START OF ROM POINTER0456 MEMTOP = $02E5 741 END OF FREE RAM0457 MEMLO = $02E7 7430458 ; $02E9 K} 745 (800) SPARE0459 HNDLOD = $02E9 745 (XL) HANDLER LOADER FLAG0460 DVSTAT = $02EA 746 DEVICE STATUS BUFFER, 4 BYTK}ES0461 CBAUDL = $02EE 750 CASSETTE BAUD RATE, 2 BYTES0462 CRSINH = $02F0 752 1 = INHIBIT CURSOR0463 KEYDEL = $02F1 K} 753 KEY DELAY AND RATE0464 CH1 = $02F2 7540465 CHACT = $02F3 7550466 CHBAS = $02F4 756 CHARACTER SET POINTK}ER0467 NEWROW = $02F5 757 (XL) DRAW DESTINATION0468 NEWCOL = $02F6 758 (XL) DRAW DESTINATION0469 ROWINC = $02F8 7K}60 (XL)0470 COLINC = $02F9 761 (XL)0471 CHAR = $02FA 7620472 ATACHR = $02FB 763 ATASCII CHARACTER FOR CIO0473 K}CH = $02FC 7640474 FILDAT = $02FC 764 COLOR FOR SCREEN FILL0475 DSPFLG = $02FE 766 DISPLAY CONTROL CHARACTERS K}FLAG0476 SSFLAG = $02FF 767 DISPLAY START/STOP FLAFG0477 ;0478 ;0479 ; PAGE 30480 ;0481 ;0482 ; RESIDK}ENT DISK HANDLER/SIO INTERFACE0483 ;0484 DCB = $0300 768 DEVICE CONTROL BLOCK0485 DDEVIC = $0300 7680486 DUNIT K}= $0301 7690487 DCOMND = $0302 7700488 DSTATS = $0303 7710489 DBUFLO = $0304 7720490 DBUFHI = $0305 77304K}91 DTIMLO = $0306 7740492 DBYTLO = $0308 7760493 DBYTHI = $0309 7770494 DAUX1 = $030A 7780495 DAUX2 = $030BK} 7790496 TIMER1 = $030C 780 INITIAL TIMER VALUE0497 ADDCOR = $030E 782 (800) ADDITION CORRECTION0498 JMPERS = $03K}0E 782 (XL) OPTION JUMPERS0499 CASFLG = $030F 783 CASSETTE MODE WHEN SET0500 TIMER2 = $0310 784 FINAL VALUE, TIMERK}S 1 & 2 DETERMINE BAUD RATE0501 TEMP1 = $0312 7860502 TEMP2 = $0313 787 (XL)0503 TEMP2 = $0314 788 (800)0504 K}PTIMOT = $0314 788 (XL) PRINTER TIME OUT0505 TEMP3 = $0315 7890506 SAVIO = $0316 790 SAVE SERIAL IN DATA PORT05K}07 TIMFLG = $0317 791 TIME OUT FLAG FOR BAUD RATE CORRECTION0508 STACKP = $0318 792 SIO STACK POINTER SAVE0509 TSTAT K} = $0319 793 TEMPORARY STATUS HOLDER0510 HATABS = $031A 794 HANDLER ADDRESS TABLE, 38 BYTES0511 MAXDEV = $0321 801K} MAXIMUM HANDLER ADDRESS INDEX0512 PUPBT1 = $033D 829 (XL) POWER-UP/RESET0513 PUPBT2 = $033E 830 (XL) POWER-UP/RESETK}0514 PUPBT3 = $033F 831 (XL) POWER-UP/RESET0515 ;0516 ;IOCB's0517 ;0518 IOCB = $0340 8320519 ICHID = $0340 8K}320520 ICDNO = $0341 8330521 ICCOM = $0342 8340522 ICSTA = $0343 8350523 ICBAL = $0344 8360524 ICBAH = K}$0345 8370525 ICPTL = $0346 8380526 ICPTH = $0347 8390527 ICBLL = $0348 8400528 ICBLH = $0349 8410529K} ICAX1 = $034A 8420530 ICAX2 = $034B 8430531 ICAX3 = $034C 8440532 ICAX4 = $034D 8450533 ICAX5 = $034E K} 8460534 ICAX6 = $034F 8470535 ; OTHER IOCB's, 112 BYTES0536 PRNBUF = $03C0 960 PRINTER BUFFERK}, 40 BYTES0537 ; $03E8 1000 (800) 21 SPARE BYTES0538 SUPERF = $03E8 1000 (XL) SCREEN EDITOR0539 CKEY = $03E9 K} 1001 (XL) START KEY FLAG0540 CASSBT = $03EA 1002 (XL) CASSETTE BOOT FLAG0541 CARTCK = $03EB 1003 (XL) CARTRIDGE CHECKK}SUM0542 ACMVAR = $03ED 1005 (XL) RESERVED, 6 BYTES0543 MINTLK = $03F9 1017 (XL) RESERVED0544 GINTLK = $03FA 1018 (XLK}) CARTRIDGE INTERLOCK0545 CHLINK = $03FB 1019 (XL) HANDLER CHAIN, 2 BYTES0546 CASBUF = $03FD 1021 CASSETTE BUFFER, 131 K}BYTES TO $047F0547 ;0548 ;0549 ; PAGE 40550 ;0551 ;0552 USAREA = $0480 1152 128 SPARE BYTES0553 ;0554 ; K} SEE APPENDIX C FOR PAGES 4 AND 5 USAGE0555 ;0556 ;0550 ;0551 ;0552 USAREA = $0480 1152 128 SPARE BYTES0553 ;0554 ; H50039630100 ; GRAFMAC.LIB0110 ;0120 GRAFMAC0130 ;0140 .IF .NOT .DEF CIOMAC0150 .ERROR "mO}ust include CIOMAC.LIB"0160 .ENDIF 0170 ;0180 ; GRAPHICS MACROS0190 ;0200 ; REQUIRES CIOMAC.LIB0210 ;0220 ;0230O} ;0240 ; MACRO: GRAPHICS0250 ;0260 ; FORM: GRAPHICS mode0270 ;0280 ; enters a graphics mode as in0290 ; BASIC0300 ;0O}310 .MACRO GRAPHICS 0320 .IF %1>310330 LDY #00340 @LOOP LDA PCOLR0,Y0350 PHA 0360 INY 0370 O} CPY #90380 BNE @LOOP0390 .ENDIF 0400 @LA %10410 AND #$F00420 EOR #$10 ;COMP S IN AUX10O}430 ORA #$0C0440 STA TEMP0450 @LA %10460 AND #$0F0470 STA TEMP+10480 .IF %1>00490 CLOSO}E 60500 OPEN 6,TEMP,TEMP+1,"S:"0510 .ELSE 0520 CLOSE 00530 OPEN 0,12,0,"E:"0540 .ENO}DIF 0550 .IF %1>310560 LDY #00570 @LOOP2 PLA 0580 STA PCOLR0,Y0590 INY 0600 CPY #90610 O} BNE @LOOP20620 .ENDIF 0630 .ENDM 0640 ;0650 .MACRO GR 0660 GRAPHICS %10670 .ENDM 0680 ;069O}0 ;0700 ; MACRO: COLOR0710 ;0720 ; FORM: COLOR data0730 ;0740 ; selects color register as in0750 ; BASIC color statemeO}nt0760 ;0770 .MACRO COLOR 0780 @LA %10790 STA COLOR0800 .ENDM 0810 ;0820 ;0830 ;0840 ; MACRO: PLOTO}0850 ;0860 ; FORM: PLOT X,Y0870 ;0880 ; same as BASIC plot0890 ;0900 .MACRO PLOT 0910 .IF %1<3200920 LO}DA # <%10930 STA COLCRS0940 LDA # >%10950 STA COLCRS+10960 .ELSE 0970 LDA %10980 STO}A COLCRS0990 LDA %1+11000 STA COLCRS+11010 .ENDIF 1020 @LA %21030 STA ROWCRS1040 LDA COO}LOR1050 STA ATACHR1060 BPUT 6,ATACHR,11070 .ENDM 1080 ;1090 ;1100 ;1110 ; MACRO: DRAWTO1120 ;1130 ; FO}ORM: DRAWTO X,Y1140 ;1150 ; same as basic drawto1160 ;1170 .MACRO DRAWTO 1180 .IF %1<3201190 LDA # <%112O}00 STA COLCRS1210 LDA # >%11220 STA COLCRS+11230 .ELSE 1240 LDA %11250 STA COLCRS12O}60 LDA %1+11270 STA COLCRS+11280 .ENDIF 1290 @LA %21300 STA ROWCRS1310 LDA COLOR1320 O} STA ATACHR1330 LDX #61340 LDA ICAX1,X1350 STA TEMP1360 LDA ICAX2,X1370 STA TEMP+11380 XIO $O}11,6,TEMP,TEMP+1,"S:"1390 .ENDM 1400 ;1410 .MACRO DR 1420 DRAWTO %1,%21430 .ENDM 1440 ;1450 ;1460 ;O} MACRO: SETCOLOR1470 ;1480 ; FORM: SETCOLOR color,hue,lum1490 ;1500 ; same as BASIC setcolor command1510 ;1520 .MAO}CRO SETCOLOR 1530 @LA %11540 TAY 1550 @LA %21560 ASL A1570 ASL A1580 ASL A1590 ASL A1O}600 .IF %3<161610 ORA #%31620 .ELSE 1630 ORA %31640 .ENDIF 1650 TAX 1660 LDA DINDEXO}1670 CMP #91680 BEQ @B11690 INY 1700 INY 1710 INY 1720 INY 1730 @B1 TXA 1740 STA PCOLR0,YO}1750 .ENDM 1760 ;1770 .MACRO SE 1780 SETCOLOR %1,%2,%31790 .ENDM 1800 ;1810 ;1820 ; MACRO: TPOS183O}0 ;1840 ; FORM: TPOS X,Y1850 ;1860 ; position for text window1870 ;1880 .MACRO TPOS 1890 .IF %2<20 .OR %2>231O}900 .ERROR "TPOS cursor out of range"1910 .ENDIF 1920 @LA #%11930 STA TXTCOL1940 @LA O} #%21950 STA TXTROW1960 .ENDM 1970 ;1980 ;1990 ;2000 ; MACRO: LOCATE2010 ;2020 ; FORM: LOCATE X,Y2030 ;O}2040 ; same as BASIC LOCATE except2050 ; color data is put in2060 ; ATACHR2070 ;2080 .MACRO LOCATE 2090 .IF %1<3O}202100 LDA # <%12110 STA COLCRS2120 LDA # >%12130 STA COLCRS+12140 .ELSE 2150 LDA %O}12160 STA COLCRS2170 LDA %1+12180 STA COLCRS+12190 .ENDIF 2200 @LA %22210 STA ROWCRSO}2220 BGET 6,ATACHR,12230 .ENDM 2240 ;2250 ;2260 ;S+12190 .ENDIF 2200 @LA %22210 STA ROWCRSL@